productEdit.jsp 122 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799
  1. <%@ page import="com.thinkgem.jeesite.common.config.Global" %>
  2. <%@ taglib prefix="input" uri="/struts-tags" %>
  3. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  4. <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
  5. <html>
  6. <head>
  7. <title>编辑商品</title>
  8. <meta name="decorator" content="default"/>
  9. <link type="text/css" rel="stylesheet" href="${ctxStatic}/bootstrap-select/css/bootstrap-select.css"></link>
  10. <style>
  11. .sku-item-li{
  12. width: 100%;
  13. height: auto;
  14. float: left;
  15. margin-bottom: 5px;
  16. }
  17. .sku {
  18. display: flex;
  19. align-items: center;
  20. flex-wrap: wrap;
  21. border: 2px solid #666;
  22. padding: 10px;
  23. white-space: nowrap;
  24. margin-top: 10px;
  25. width: 1000px;
  26. }
  27. .sku-item-delete{
  28. width: 40%;
  29. height: auto;
  30. float: left;
  31. margin-left: 10px;
  32. }
  33. .sku .sku-item {
  34. float: left;
  35. margin-right: 12px;
  36. padding: 4px 0;
  37. }
  38. .red {
  39. color: red;
  40. }
  41. .blue {
  42. color: rgb(0, 100, 180);
  43. }
  44. #inputForm {
  45. max-width: 1200px;
  46. width: 100%;
  47. }
  48. #inputForm table {
  49. width: 100%;
  50. line-height: 18px;
  51. margin-bottom: 50px;
  52. }
  53. #inputForm th, #inputForm td {
  54. font-weight: normal;
  55. text-align: left;
  56. padding: 8px 5px;
  57. border-bottom: 1px solid rgb(238, 238, 238);
  58. }
  59. #inputForm th {
  60. width: 15%;
  61. text-align: right;
  62. white-space: nowrap;
  63. font-weight: bold;
  64. }
  65. #inputForm td input[type="text"] {
  66. width: 320px;
  67. height: 16px;
  68. line-height: 16px;
  69. }
  70. #inputForm td input.short {
  71. width: 110px;
  72. }
  73. #inputForm td b.line {
  74. margin: 0 15px 0 20px;
  75. font-weight: normal
  76. }
  77. #allAreaInput {
  78. padding: 10px 0 0 100px;
  79. }
  80. #inputForm .item {
  81. line-height: 28px;
  82. }
  83. /*#ladderPriceBox {*/
  84. /* border-top: 1px solid rgb(238, 238, 238);*/
  85. /* margin-top: 8px;*/
  86. /* padding-top: 8px;*/
  87. /*}*/
  88. /*#ladderPriceBox > div {*/
  89. /* margin-bottom: 5px;*/
  90. /*}*/
  91. .priceIcon:before {
  92. content: '\2729';
  93. color: #aaa;
  94. font-size: 18px;
  95. font-style: normal;
  96. }
  97. .priceIcon.full:before {
  98. content: '\272E';
  99. color: #ffbd14;
  100. }
  101. #slider {
  102. width: 335px;
  103. }
  104. .skword input {
  105. margin: 2px 0;
  106. }
  107. .skword p {
  108. margin: 2px 0;
  109. }
  110. .params input {
  111. margin: 2px 0;
  112. }
  113. .tags input {
  114. margin: 2px 0;
  115. }
  116. #tagsList {
  117. margin: 2px 0;
  118. display: none;
  119. width: 600px;
  120. }
  121. .tags-li {
  122. margin: 10px;
  123. display: inline-block;
  124. padding: 5px 10px;
  125. line-height: 16px;
  126. text-align: center;
  127. position: relative;
  128. font-size: 12px;
  129. border: 1px solid #EBEBEB;
  130. border-radius: 4px;
  131. }
  132. .tags-li i {
  133. font-style: normal;
  134. line-height: 20px;
  135. display: block;
  136. position: absolute;
  137. width: 16px;
  138. height: 16px;
  139. text-align: center;
  140. background: rgba(0, 0, 0, 0.2);
  141. border-radius: 50%;
  142. top: -8px;
  143. right: -7px;
  144. cursor: pointer;
  145. }
  146. .tags-li .tags-s {
  147. background: #FFF;
  148. width: auto !important;
  149. outline: none;
  150. border: none;
  151. }
  152. .upload-content {
  153. /*margin-top: -70px;*/
  154. display: inline-block;
  155. }
  156. .conList {
  157. float: left;
  158. }
  159. .upload-content .conList .btn:nth-of-type(1) {
  160. width: 90px;
  161. height: 113px;
  162. border: 2px solid #eee;
  163. background: #fff;
  164. position: relative;
  165. }
  166. .upload-content .conList .btn:nth-of-type(1) > div {
  167. position: absolute;
  168. top: 50%;
  169. left: 50%;
  170. transform: translate(-50%, -50%);
  171. color: #666;
  172. }
  173. .upload-content .conList .btn:nth-of-type(1) span {
  174. font-size: 35px;
  175. }
  176. .upload-content .conList .btn:nth-of-type(1) h5 {
  177. color: #666;
  178. }
  179. .cancel-upload {
  180. background: transparent;
  181. border: none;
  182. box-shadow: none;
  183. position: relative;
  184. top: -53px;
  185. left: -25px;
  186. cursor: pointer;
  187. z-index: 100;
  188. }
  189. .upload-content .conList ol {
  190. list-style-type: none;
  191. }
  192. .upload-content .conList ol li {
  193. width: 114px;
  194. height: 114px;
  195. text-align: center;
  196. background: #fff;
  197. position: relative;
  198. top: 130px;
  199. margin-left: 2px;
  200. left: -25px;
  201. overflow: hidden;
  202. }
  203. .upload-content-image {
  204. margin-top: -70px;
  205. }
  206. .upload-content-image .conList .btn:nth-of-type(1) {
  207. width: 90px;
  208. height: 100px;
  209. border: 2px solid #eee;
  210. background: #fff;
  211. position: relative;
  212. }
  213. .upload-content-image .conList .btn:nth-of-type(1) > div {
  214. position: absolute;
  215. top: 50%;
  216. left: 50%;
  217. transform: translate(-50%, -50%);
  218. color: #666;
  219. }
  220. .upload-content-image .conList .btn:nth-of-type(1) span {
  221. font-size: 35px;
  222. }
  223. .upload-content-image .conList .btn:nth-of-type(1) h5 {
  224. color: #666;
  225. }
  226. .upload-content-image .conList ol li {
  227. width: 114px;
  228. min-height: 80px;
  229. text-align: center;
  230. background: #fff;
  231. position: relative;
  232. top: 136px;
  233. margin-left: 2px;
  234. left: -25px;
  235. }
  236. .cancel-upload-image {
  237. background: transparent;
  238. border: none;
  239. box-shadow: none;
  240. position: relative;
  241. top: -38px;
  242. left: -25px;
  243. cursor: pointer;
  244. z-index: 100;
  245. }
  246. .hide-pic {
  247. display: none !important;
  248. }
  249. .hide-pic-image {
  250. display: none !important;
  251. }
  252. .form-horizontal .controls:first-child {
  253. padding-left: 0 !important;
  254. margin-left: 0 !important;
  255. }
  256. </style>
  257. </head>
  258. <body>
  259. <ul class="nav nav-tabs">
  260. <li><a href="${ctx}/product/new/list">商品信息列表</a></li>
  261. <c:if test="${not empty product.id}">
  262. <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">商品信息编辑</a></li>
  263. </c:if>
  264. <%-- <c:if test="${empty product.id}">--%>
  265. <%-- <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">发布特殊供应商商品</a></li>--%>
  266. <%-- </c:if>--%>
  267. </ul>
  268. <form:form id="inputForm" modelAttribute="product"
  269. 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}"
  270. method="post" class="form-horizontal">
  271. <form:hidden path="id"/>
  272. <form:hidden path="searchName"/>
  273. <form:hidden path="shopID" id="shopId" />
  274. <sys:message content="${message}"/>
  275. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  276. <tr>
  277. <th><b class="blue">商品基本信息:</b></th>
  278. <td colspan="3"></td>
  279. </tr>
  280. <tr>
  281. <th><span class="red">*</span>商品显示名:</th>
  282. <td colspan="3">
  283. <form:input path="name" maxlength="100" onchange="checkmaxlength(this.value)"
  284. class="input-small required"/>
  285. <span>
  286. <span style="font-weight: bold;">商品编码:</span>
  287. <span><form:input path="productCode" maxlength="100"/></span>
  288. </span>
  289. </td>
  290. </tr>
  291. <tr>
  292. <th><span class="red">*</span>内部商品名:</th>
  293. <td colspan="3">
  294. <form:input path="aliasName" maxlength="100" onchange="checkmaxlength(this.value)"
  295. class="input-small required"/>
  296. <span>
  297. <span style="font-weight: bold;">商品备注:</span>
  298. <span><form:input path="productRemarks" maxlength="60" onchange="checkmaxlengths(this.value,60)"
  299. class="input-small"/></span>
  300. </span>
  301. </td>
  302. </tr>
  303. <tr>
  304. <th>搜索关键字:</th>
  305. <td colspan="3" class="skword auto-input">
  306. <form:input path="searchKeyList[0]" maxlength="32" placeholder="建议输入品牌关键词"
  307. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  308. <form:input path="searchKeyList[1]" maxlength="32" placeholder="建议输入商品学名关键词"
  309. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  310. <form:input path="searchKeyList[2]" maxlength="32" placeholder="建议输入商品别名/市场称呼关键词"
  311. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  312. <form:input path="searchKeyList[3]" maxlength="32" placeholder="建议输入商品大分类关键词"
  313. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  314. <form:input path="searchKeyList[4]" maxlength="32" placeholder="建议输入商品小分类关键词"
  315. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  316. <p>请务必准确定义关键词,关键词会影响商品的搜索结果,建议从品牌,商品学名,商品别名,商品大类别和商品小类别5个方面考虑,每个关键词不超过16个汉字。</p>
  317. </td>
  318. </tr>
  319. <tr>
  320. <th>关联标签库:</th>
  321. <td colspan="3">
  322. <select class="selectpicker" multiple id="labelSelectBox" style="width: 240px" name="labelIds">
  323. <c:forEach items="${SearchFrequencyVo}" var="sea">
  324. <option value="${sea.id}">${sea.keyword}</option>
  325. </c:forEach>
  326. </select>&nbsp;&nbsp;&nbsp;&nbsp;
  327. <c:if test="${!empty product.keywords}">
  328. <span style="display: inline-block; width: 120px">供应商关联标签:(${product.shopName})</span>
  329. <span><textarea rows="6" style="width: 700px;">${product.keywords}</textarea></span>
  330. </c:if>
  331. </td>
  332. </tr>
  333. <tr>
  334. <th>相关参数:</th>
  335. <td colspan="3" class="params">
  336. <div id="addParamsItems">
  337. <%--相关参数层--%>
  338. <input type="hidden" value="${fn:length(product.productParametersList)}"
  339. id="productParametersLength">
  340. <c:forEach items="${product.productParametersList}" var="item" varStatus="varIndex">
  341. <div id="paramsItem" class="paramsItem">
  342. <form:input path="productParametersList[${varIndex.index}].paramsName" id="paramsName"
  343. cssStyle="width:142px" maxlength="10" placeholder="参数名称" class="input-small"/>
  344. <form:input path="productParametersList[${varIndex.index}].paramsContent" id="paramsContent"
  345. cssStyle="width:680px" maxlength="50" placeholder="请输入参数信息"
  346. class="input-small"/>
  347. <span type="button" style="cursor: pointer;color: #0B61A4"
  348. onclick="deleteParams(this)">删除</span>
  349. </div>
  350. </c:forEach>
  351. </div>
  352. <button class="addParams" onclick="return false">添加参数</button>
  353. </td>
  354. </tr>
  355. <tr>
  356. <th>品牌:</th>
  357. <td colspan="3">
  358. <form:select path="brandID" class="input-small">
  359. <form:option value="" label="请选择"/>
  360. <form:options items="${brandList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
  361. </form:select>
  362. </td>
  363. </tr>
  364. <c:if test="${product.shopType == 2}">
  365. <tr>
  366. <th><span style="color: red">*</span>供应商:</th>
  367. <td colspan="3">
  368. <form:select path="shopID" class="input-small required" onchange="getCodes(this.value)">
  369. <form:option value="" label="请选择"/>
  370. <c:forEach items="${shopList}" var="shop" varStatus="index">
  371. <form:option value="${shop.shopID}" label="${shop.name}"/>
  372. </c:forEach>
  373. </form:select>
  374. </td>
  375. </tr>
  376. <tr>
  377. <th>商品图片:</th>
  378. <td>
  379. <div class="controls upload-content" id="secondHandImage" style="width: 800px;">
  380. <div class="conList">
  381. <form:hidden value="${product.image1}" id="image1" path="image1" htmlEscape="false"
  382. maxlength="255" class="input-xlarge required"/>
  383. <sys:ckfinder input="image1" type="images" uploadPath="/photo" selectMultiple="false"
  384. maxWidth="100"
  385. maxHeight="100"/>
  386. </div>
  387. <div class="conList hide-pic">
  388. <form:hidden value="${product.image2}" id="image2" path="image2" htmlEscape="false"
  389. maxlength="255" class="input-xlarge"/>
  390. <sys:ckfinder input="image2" type="images" uploadPath="/photo" selectMultiple="false"
  391. maxWidth="100"
  392. maxHeight="100"/>
  393. </div>
  394. <div class="conList hide-pic">
  395. <form:hidden value="${product.image3}" id="image3" path="image3" htmlEscape="false"
  396. maxlength="255" class="input-xlarge"/>
  397. <sys:ckfinder input="image3" type="images" uploadPath="/photo" selectMultiple="false"
  398. maxWidth="100"
  399. maxHeight="100"/>
  400. </div>
  401. <div class="conList hide-pic">
  402. <form:hidden value="${product.image4}" id="image4" path="image4" htmlEscape="false"
  403. maxlength="255" class="input-xlarge"/>
  404. <sys:ckfinder input="image4" type="images" uploadPath="/photo" selectMultiple="false"
  405. maxWidth="100"
  406. maxHeight="100"/>
  407. </div>
  408. <div class="conList hide-pic">
  409. <form:hidden value="${product.image5}" id="image5" path="image5" htmlEscape="false"
  410. maxlength="255" class="input-xlarge"/>
  411. <sys:ckfinder input="image5" type="images" uploadPath="/photo" selectMultiple="false"
  412. maxWidth="100"
  413. maxHeight="100"/>
  414. </div>
  415. </div>
  416. <div class="conList upload-tips" style="margin-top: 20px;">
  417. <font color="red">第一张图作为商品主图必传;最多上传5张商品图片,请尽量全部上传,单张图片不能超过5M</font>
  418. </div>
  419. </td>
  420. </tr>
  421. </c:if>
  422. <tr>
  423. <th>组合名称:</th>
  424. <td colspan="3">
  425. <form:select path="combinationID" class="input-small">
  426. <form:option value="" label="请选择"/>
  427. <form:options items="${combinationList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
  428. </form:select>
  429. </td>
  430. </tr>
  431. <tr>
  432. <th><span class="red">*</span>商品标签:</th>
  433. <td colspan="3">
  434. <input id="inputTags" maxlength="15" style="width:217px;border-radius:5px" placeholder="请输入商品标签"
  435. class="input-small"/>
  436. <button class="addTags" onclick="return false">添加标签</button>
  437. <p style="margin-top: 5px">简述商品功效和特性,最多可添加6个标签,每个标签字数不超过15个汉字(如:美白祛斑,消除皱纹)</p>
  438. <div id="tagsList">
  439. <input type="hidden" name="tagsLists" value="${product.tags}" id="tagsLists">
  440. <%--标签--%>
  441. </div>
  442. </td>
  443. </tr>
  444. <tr>
  445. <th><span class="red">*</span>商品属性:</th>
  446. <td colspan="3">
  447. <label><input type="radio" name="commodityType" value="1"
  448. onchange="loadBigType()" ${product.commodityType == "1" ? "checked" : ""} />产品<b
  449. class="line">|</b></label>
  450. <label><input type="radio" name="commodityType" value="2"
  451. onchange="loadBigType()" ${product.commodityType == "2" ? "checked" : ""} />仪器</label>
  452. </td>
  453. </tr>
  454. <tr class="training" hidden>
  455. <th><span class="red">*</span>培训方式:</th>
  456. <td colspan="3">
  457. <label><input type="radio" name="trainingMethod"
  458. value="1" ${empty product.trainingMethod || product.trainingMethod == 1 ? "checked" : ""} />线上培训<b
  459. class="line">|</b></label>
  460. <label><input type="radio" name="trainingMethod"
  461. value="2" ${product.trainingMethod == 2 ? "checked" : ""} />线下培训</label>
  462. </td>
  463. </tr>
  464. <tr class="training" hidden>
  465. <th><span class="red">*</span>培训费用:</th>
  466. <td colspan="3">
  467. <label><input type="radio" name="trainingType"
  468. value="1" ${empty product.trainingType || product.trainingType == 1 ? "checked" : ""}
  469. onchange="trainingShow()"/>售价未包含<b class="line">|</b></label>
  470. <label><input type="radio" name="trainingType" value="2" ${product.trainingType == 2 ? "checked" : ""}
  471. onchange="trainingShow()"/>售价已包含</label>
  472. </td>
  473. </tr>
  474. <tr id="trainingFee" hidden>
  475. <th></th>
  476. <td colspan="3">
  477. <input type="number" name="trainingFee" value="${product.trainingFee}" style="width: 250px" min="0"
  478. placeholder="请填写包含食宿,交通等各项费用的总金额"/>
  479. </td>
  480. </tr>
  481. <tr>
  482. <th><span class="red">*</span>分类:</th>
  483. <td colspan="3">
  484. <form:select path="bigTypeID" class="input-small required" id="bigType" onchange="loadSmallType()">
  485. <form:option value="" label="请选择"/>
  486. <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
  487. htmlEscape="false"/>
  488. </form:select>
  489. <form:select path="smallTypeID" class="input-small" id="smallType" onchange="loadTinyType()">
  490. <form:option value="" label="请选择"/>
  491. <c:forEach items="${classify.smalltypeList}" var="smallType">
  492. <form:option value="${smallType.smallTypeID}" label="${smallType.name}"
  493. bigTypeID="${smallType.bigTypeID}"/>
  494. </c:forEach>
  495. </form:select>
  496. <form:select path="tinyTypeID" class="input-small" id="tinyType">
  497. <form:option value="" label="请选择"/>
  498. <c:forEach items="${classify.tinytypeList}" var="tinyType">
  499. <form:option value="${tinyType.tinyTypeID}" label="${tinyType.name}"
  500. bigTypeID="${tinyType.smallTypeID}"/>
  501. </c:forEach>
  502. </form:select>
  503. </td>
  504. </tr>
  505. <tr>
  506. <th><span class="red">*</span>商品类型:</th>
  507. <td colspan="3">
  508. <form:select path="productType" id="productType" onchange="js()" class="input-small required"
  509. onclick="changeMachine(this)">
  510. <form:option value="" label="请选择"/>
  511. <form:option value="1" label="妆字号"/>
  512. <form:option value="2" label="械字号"/>
  513. <form:option value="0" label="其它"/>
  514. </form:select>
  515. <span class="machineType">
  516. <form:select path="machineType" id="machineType" onchange="js()" class="input-small">
  517. <form:option value="" label="请选择"/>
  518. <form:option value="1" label="一类"/>
  519. <form:option value="2" label="二类"/>
  520. <form:option value="3" label="三类"/>
  521. </form:select>
  522. </span>
  523. </td>
  524. </tr>
  525. <tr id="xiezihao" class="machineType">
  526. <th><span class="red">*</span>资质证书:</th>
  527. <td colspan="3">
  528. <%-- 械字号医疗证书--%>
  529. <form:hidden id="qualificationImg" path="qualificationImg" htmlEscape="false" maxlength="255"
  530. class="input-xlarge"/>
  531. <sys:ckfinder input="qualificationImg" type="images" uploadPath="/photo" selectMultiple="false"
  532. maxWidth="100" maxHeight="100"/>
  533. </td>
  534. </tr>
  535. <tr class="machineType">
  536. <th><span class="red">*</span>证书编号:</th>
  537. <td colspan="1">
  538. <form:input path="qualificationNo" maxlength="50" class="input-small"/>
  539. </td>
  540. </tr>
  541. <tr class="machineType">
  542. <th><span class="red">*</span>产品名称:</th>
  543. <td colspan="2">
  544. <form:input path="productName" maxlength="80" class="input-small"/>
  545. </td>
  546. </tr>
  547. <tr class="machineType">
  548. <th><span class="red">*</span>证书有效期:</th>
  549. <td colspan="3">
  550. <%-- <form:input path="qualificationTime" type="text" maxlength="20" class="input-medium Wdate" value="${product.qualificationTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>--%>
  551. <form:input path="qualificationTime" type="text" maxlength="10" class="input-medium Wdate"
  552. value="${qualificationTime}"
  553. onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
  554. </td>
  555. </tr>
  556. <tr class="machineType">
  557. <th><span class="red">*</span>证书基本信息链接:</th>
  558. <td colspan="4">
  559. <form:input path="qualificationLink" maxlength="300"
  560. class="input-small"/>
  561. </td>
  562. </tr>
  563. <tr>
  564. <th><span class="red">*</span>上架平台:</th>
  565. <td>
  566. <input id="caimei" type="checkbox" name="groundMall" value="0" >【采美】平台
  567. <input id="bcc" type="checkbox" name="groundMall" value="4" >【丽格集采联盟】平台
  568. </td>
  569. </tr>
  570. <tr id="groundSkuCaimei">
  571. <th><span class="red">*</span>SKU种类:<br><span class="red">【采美】平台</span></th>
  572. <td>
  573. <div><span><button class="addSku" onclick="return false">添加SKU</button></span></div>
  574. <div class="sku-item sku-costCheckFlag" style="margin-top: 15px;">
  575. <span class="red">*</span>成本类型:
  576. <label><input type="radio" name="costCheckFlag" class="costCheckFlag" value="1"
  577. ${empty product.costCheckFlag || product.costCheckFlag == 1 ? "checked" : ""} />固定成本</label>
  578. <b class="line">|</b>
  579. <label><input type="radio" name="costCheckFlag" class="costCheckFlag" value="2"
  580. ${empty product.costCheckFlag || product.costCheckFlag == 2 ? "checked" : ""} />比例成本</label>
  581. </div>
  582. <%-- 插入html --%>
  583. <div id="skus"></div>
  584. </td>
  585. </tr>
  586. <tr id="groundSkuBcc">
  587. <th><span class="red">*</span>SKU种类:<br><span class="red">【丽格集采联盟】平台</span></th>
  588. <td>
  589. <div><span><button class="addMallSku" onclick="return false">添加SKU</button></span></div>
  590. <div class="sku-item sku-costCheckFlag" style="margin-top: 15px;">
  591. <span class="red">*</span>成本类型:
  592. <label><input type="radio" name="mallCostCheckFlag" class="mallCostCheckFlag" value="1"
  593. ${empty product.mallCostCheckFlag || product.mallCostCheckFlag == 1 ? "checked" : ""} />固定成本</label>
  594. <b class="line">|</b>
  595. <label><input type="radio" name="mallCostCheckFlag" class="mallCostCheckFlag" value="2"
  596. ${empty product.mallCostCheckFlag || product.mallCostCheckFlag == 2 ? "checked" : ""} />比例成本</label>
  597. </div>
  598. <%-- 插入html --%>
  599. <div id="mallSkus"></div>
  600. </td>
  601. </tr>
  602. <tr>
  603. <th><span class="red">*</span>是否含税:</th>
  604. <td>
  605. <label><input type="radio" name="includedTax" value="1"
  606. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "1" ? "checked" : ""}>含税<b
  607. class="line">|</b></label>
  608. <label><input type="radio" name="includedTax" value="0"
  609. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "0" ? "checked" : ""}>不含税<b
  610. class="line">|</b></label>
  611. <label><input type="radio" name="includedTax" value="2"
  612. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "2"||product.includedTax==null ? "checked" : ""}>未知</label>
  613. </td>
  614. </tr>
  615. <tr id="invoiceItem">
  616. <th></th>
  617. <td>
  618. <span class="invoice">
  619. <label><input type="radio" name="invoiceType" value="1"
  620. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "1" ? "checked" : ""}>开增值税专用发票<b
  621. class="line">|</b></label>
  622. <label><input type="radio" name="invoiceType" value="2"
  623. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "2" ? "checked" : ""}>开增值税普通发票</label>
  624. </span>
  625. <span class="notInvoice">
  626. <b class="line">|</b>
  627. <label><input type="radio" name="invoiceType" value="3"
  628. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "3"||product.invoiceType ==null ? "checked" : ""}>不能开票</label>
  629. </span>
  630. </td>
  631. </tr>
  632. <tr>
  633. <th>线上分账账号:</th>
  634. <td colspan="3">
  635. <c:if test="${not empty product.productID}">
  636. <form:select path="splitCode" class="select-ele input-medium">
  637. <form:option value="" label="请选择"/>
  638. <c:forEach items="${splitCodeList}" var="splitCodeList" varStatus="index">
  639. <form:option value="${splitCodeList.splitCode}" label="${splitCodeList.codeRemark}"/>
  640. </c:forEach>
  641. </form:select>
  642. </c:if>
  643. <c:if test="${empty product.productID}">
  644. <form:select path="splitCode" class="select-ele input-medium" id="getCode">
  645. <form:option value="" label="请选择"/>
  646. </form:select>
  647. </c:if>
  648. </td>
  649. </tr>
  650. <tr id="taxPointDiv">
  651. <th><span class="red">*</span>机构税率:</th>
  652. <td>
  653. <span><form:input path="taxPoint" maxlength="5" cssStyle="width: 35PX" class="number"
  654. onchange="setTwoNumberDecimal(this)"/>%</span>
  655. </td>
  656. </tr>
  657. <tr id="supplierTaxPointDiv">
  658. <th><span class="red">*</span>供应商税率:</th>
  659. <td>
  660. <span><form:input path="supplierTaxPoint" maxlength="5" cssStyle="width: 35PX" class="number"
  661. onchange="setTwoNumberDecimal(this)"/>%</span>
  662. </td>
  663. </tr>
  664. <tr>
  665. <th><span class="red">*</span>商品可见度:</th>
  666. <td colspan="3">
  667. <form:select path="visibility" class="input-large required">
  668. <form:option value="3" label="所有人可见"/>
  669. <form:option value="2" label="所有机构可见"/>
  670. <form:option value="1" label="仅资质机构可见"/>
  671. <form:option value="4" label="仅医美机构可见"/>
  672. </form:select>
  673. </td>
  674. </tr>
  675. <tr>
  676. <th><span class="red">*</span>价格可见度:</th>
  677. <td colspan="3">
  678. <form:select path="priceFlag" class="input-large required">
  679. <form:option value="0" label="所有机构可见"/>
  680. <form:option value="2" label="仅资质机构可见"/>
  681. <form:option value="3" label="仅医美机构可见"/>
  682. <form:option value="1" label="价格不可见"/>
  683. </form:select>
  684. </td>
  685. </tr>
  686. <tr>
  687. <th><span class="red">*</span>商品详情可见度:</th>
  688. <td colspan="3">
  689. <form:select path="commodityDetailsFlag" class="input-large required">
  690. <form:option value="1" label="所有人可见"/>
  691. <form:option value="2" label="所有机构可见"/>
  692. <form:option value="3" label="仅资质机构可见"/>
  693. <form:option value="4" label="仅医美机构可见"/>
  694. </form:select>
  695. </td>
  696. </tr>
  697. <tr>
  698. <th><span class="red">*</span>能否退货:</th>
  699. <td colspan="3">
  700. <form:select path="returnGoodsStutas" class="input-large required" id="goods">
  701. <%-- ${product.returnGoodsStutas=="1" ? "selected" : ""}--%>
  702. <form:option value="1" label="能" />
  703. <form:option value="2" label="不能"/>
  704. </form:select>
  705. </td>
  706. </tr>
  707. <tr>
  708. <th><span class="red">*</span>购买数量:</th>
  709. <td colspan="3">
  710. <label><input type="radio" name="step" value="1" ${product.step == "1" ? "checked" : ""}>逐步增长<b
  711. class="line">|</b></label>
  712. <label><input type="radio" name="step" value="2" ${product.step == "2" ? "checked" : ""}>以起订量增长</label>
  713. </td>
  714. </tr>
  715. <%--<tr>
  716. <th><span class="red">*</span>运费:</th>
  717. <td colspan="3">
  718. <label><input type="radio" name="byFlag" value="0" ${product.byFlag == "0" ? "checked" : ""}>买家承担<b class="line">|</b></label>
  719. <label><input type="radio" name="byFlag" value="1" ${product.byFlag == "1" ? "checked" : ""}>卖家承担</label>
  720. </td>
  721. <td colspan="3">
  722. <label><input type="radio" name="freePostFlag"
  723. value="2" ${(empty product.freePostFlag || product.freePostFlag eq "2") ? "checked" : ""}>默认(遵循运费规则)<b
  724. class="line">|</b></label>
  725. <label><input type="radio" name="freePostFlag"
  726. value="0" ${product.freePostFlag == "0" ? "checked" : ""}>包邮<b class="line">|</b></label>
  727. <label><input type="radio" name="freePostFlag"
  728. value="1" ${product.freePostFlag == "1" ? "checked" : ""}>到付</label>
  729. </td>
  730. </tr>
  731. <tr>
  732. <th><span class="red">*</span>销售区域:</th>
  733. <td colspan="3">
  734. <label><input type="radio" name="allAreaFlag" value="1"
  735. onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "checked" : ""}>全部区域<b
  736. class="line">|</b></label>
  737. <label><input type="radio" name="allAreaFlag" value="0"
  738. onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "" : "checked"}>指定区域</label>
  739. </td>
  740. </tr>--%>
  741. <tr>
  742. <th><span class="red">*</span>首页新品展示:</th>
  743. <td colspan="3">
  744. <c:if test="${product.newProductType==1}">
  745. <input type="radio" checked="checked" name="newProductType" value="1" class="required"/>参与新品展示
  746. <input type="radio" name="newProductType" value="2" class="required"/>不参与新品展示
  747. </c:if>
  748. <c:if test="${empty product.newProductType || product.newProductType==2}">
  749. <input type="radio" name="newProductType" value="1" class="required"/>参与新品展示
  750. <input type="radio" checked="checked" name="newProductType" value="2" class="required"/>不参与新品展示
  751. </c:if>
  752. </td>
  753. </tr>
  754. <tr>
  755. <th>商品说明:</th>
  756. <td colspan="3">
  757. <form:textarea path="productDescribe" id="wipeRemarks" maxlength="200" placeholder="请输入备注文字,不能超过200字"
  758. class="input-xlarge" rows="4"></form:textarea>
  759. <p style="width:500px;text-align:left;"><span id="remarkLen" style="color:red;">0</span>/200</p>
  760. </td>
  761. </tr>
  762. <tr id="allAreaInput">
  763. <th></th>
  764. <td>
  765. <span>
  766. <form:checkboxes path="provinceIDs" items="${provinceList}" itemLabel="name" itemValue="id"/>
  767. </span>
  768. </td>
  769. </tr>
  770. <tr>
  771. <th>订购方案:</th>
  772. <td colspan="3">
  773. <div class="detailInfoEditor" style="width: 620px;">
  774. <form:textarea path="orderInfo" class="input-xlarge hide"/>
  775. <!-- 富文本编辑器 -->
  776. <div id="orderInfoEditor">${product.orderInfo}</div>
  777. </div>
  778. </td>
  779. </tr>
  780. <tr>
  781. <th>服务详情:</th>
  782. <td colspan="3">
  783. <div class="detailInfoEditor" style="width: 620px;">
  784. <form:textarea path="serviceInfo" class="input-xlarge hide"/>
  785. <!-- 富文本编辑器 -->
  786. <div id="serviceInfoEditor">${product.serviceInfo}</div>
  787. </div>
  788. </td>
  789. </tr>
  790. <tr>
  791. <th><span class="red">*</span>资质机构商品详情:</th>
  792. <td><span style="color: red">(适用于资质机构)</span></td>
  793. <th style="position: relative ;right: 500px"><span class="red">*</span>普通机构商品详情:</th>
  794. <td style="position: relative ;right: 500px"><span style="color: red">(适用于游客和个人机构,可选择是否和资质机构商品详情相同,不相同的话需要编辑内容)</span>
  795. <label>
  796. <input type="radio"
  797. name="productDetail"
  798. value="1" ${product.productDetail == "1" ? "checked" : ""} />同资质机构商品详情<b
  799. class="line">|</b>
  800. </label>
  801. <label>
  802. <input type="radio"
  803. name="productDetail"
  804. value="2" ${product.productDetail == "2" || product.productDetail == null ? "checked" : ""} />不同于资质机构商品详情(即使用以下编辑内容)
  805. </label>
  806. </td>
  807. </tr>
  808. <tr>
  809. <td colspan="2" style="vertical-align: top;">
  810. <div class="detailInfoEditor" style="width: 620px;">
  811. <form:textarea path="detailInfo" htmlEscape="false" class="input-xlarge required hide"/>
  812. <!-- 富文本编辑器 -->
  813. <div id="detailInfoEditor">${product.detailInfo}</div>
  814. </div>
  815. </td>
  816. <td colspan="3" style="vertical-align: top;">
  817. <div class="detailInfoEditor" style="width: 620px;position: relative ;right: 500px">
  818. <form:textarea path="commonDetailInfo" htmlEscape="false" class="input-xlarge required hide"/>
  819. <!-- 富文本编辑器 -->
  820. <div id="detailInfoEditor2">${product.commonDetailInfo==""||product.commonDetailInfo==null?"若要查看更多产品信息,请注册机构会员,如有疑问请联系客服。":product.commonDetailInfo}</div>
  821. </div>
  822. </td>
  823. </tr>
  824. <tr>
  825. <td colspan="4" style="text-align:center;position: relative ;right: 300px">
  826. <shiro:hasPermission name="product:product:edit">
  827. <input id="btnSave" class="btn btn-primary" type="submit" value="保 存" onclick="return checkInfo()"/>
  828. </shiro:hasPermission>
  829. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  830. </td>
  831. </tr>
  832. </table>
  833. </form:form>
  834. <!-- 富文本编辑器 -->
  835. <script type="text/html" id="skuTemplate">
  836. <div class="sku">
  837. <input type="hidden" name="skuId">
  838. <input type="hidden" name="organizeId">
  839. <input type="hidden" name="mallProductId">
  840. <div class="sku-item-li">
  841. <div class="sku-item sku-unit">
  842. <span class="red">*</span>包装规格:
  843. <input name="unit" type="text" maxlength="15" style="width: 40px" class="short required"/>
  844. </div>
  845. <div class="sku-item sku-normalPrice">
  846. <span class="red">*</span>市场价:
  847. <input style="width: 60px" name="normalPrice" type="number" maxlength="10"
  848. class="short input-small required"/>元
  849. </div>
  850. <div class="sku-item sku-price">
  851. <span class="red">*</span>机构价:
  852. <input name="price" type="number" id="price" maxlength="11" style="width: 70px"
  853. class="short computedPrice required"
  854. onkeyup="computedPriceLevel(this.value)"/>
  855. </div>
  856. <div class="sku-item sku-stock">
  857. <span>库存:</span>
  858. <input name="stock" style="width: 50px" type="number" maxlength="11" class="short required"/>
  859. </div>
  860. <div class="sku-item sku-minBuyNumber">
  861. <span class="red">*</span>起订量:
  862. <input style="width: 40px" type="number" name="minBuyNumber" maxlength="11" class="short required"/>
  863. </div>
  864. </div>
  865. <div class="sku-item-li">
  866. <%-- <div class="sku-item sku-costCheckFlag">--%>
  867. <%-- <span class="red">*</span>成本类型:--%>
  868. <%-- <label><input type="radio" name="costCheckFlag" value="1" checked/>固定成本</label>--%>
  869. <%-- <b class="line">|</b>--%>
  870. <%-- <label><input type="radio" name="costCheckFlag" value="2"/>比例成本</label>--%>
  871. <%-- </div>--%>
  872. <div class="sku-item sku-costPrice">
  873. <span class="red">*</span>
  874. <span class="costFlagText">成本价</span>:
  875. 供应商:<input style="width: 60px" name="costPrice" type="number" maxlength="11" class="short costPrice"/>
  876. 集团:<input style="width: 60px" name="organizeCostPrice" type="number" maxlength="11" class="short organizeCostPrice"/>
  877. 采美:<input style="width: 60px" name="cmCostPrice" type="number" maxlength="11" class="short cmCostPrice"/>
  878. </div>
  879. <div class="sku-item sku-shopPercent" style="display: none;">
  880. <span class="red">*</span>佣金比例:
  881. 供应商:<input style="width: 50px" name="shopPercent" type="number" maxlength="11" class="short shopPercent"/>%
  882. 集团:<input style="width: 50px" name="organizePercent" type="number" maxlength="11" class="short organizePercent"/>%
  883. 采美:<input style="width: 50px" name="cmPercent" type="number" maxlength="11" class="short cmPercent"/>%
  884. </div>
  885. </div>
  886. <div class="sku-item-li sku-item-delete">
  887. <div class="sku-item sku-ladderPriceFlag">
  888. <span class="red">*</span>商品展示价格:
  889. <label> <input type="radio" name="ladderPriceFlag" value="0" checked/> 不使用阶梯价格
  890. </label>
  891. <b class="line">|</b>
  892. <label> <input type="radio" name="ladderPriceFlag" value="1"/>使用阶梯价格</label>
  893. </div>
  894. </div>
  895. <div class="sku-item-delete"><span><button class="deleteSku" onclick="deleteDiv(this)">删除SKU</button></span></div>
  896. <div class="ladderPriceBox" style="display: none;">
  897. <div class="ladderPrice">
  898. 起订量:
  899. <input name="buyNum" min="1" type="number" maxlength="11" buyNum class="short number"/>(${product.unit})及以上,
  900. <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
  901. <a class="addBtn" href="javascript:;">添加</a>
  902. <input type="hidden" name="id"/>
  903. <input class="delFlag" type="hidden" value="1" name="delFlag"/>
  904. </span>
  905. </div>
  906. <div class="ladderPrice" style="display: none">
  907. 起订量:
  908. <input name="buyNum" type="number" maxlength="11" class="short number"/>(${product.unit})及以上,
  909. <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
  910. <a class="delBtn" href="javascript:;">删除</a>
  911. <a class="addBtn" href="javascript:;">添加</a>
  912. <input type="hidden" name="id"/>
  913. <input class="delFlag" type="hidden" value="1" name="delFlag"/>
  914. </span>
  915. </div>
  916. <div class="ladderPrice" style="display: none">
  917. 起订量:
  918. <input name="buyNum" type="number" maxlength="11" class="short number"/>(${product.unit})及以上,
  919. <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
  920. <a class="delBtn" href="javascript:;">删除</a>
  921. </span>
  922. <input type="hidden" name="id"/>
  923. <input class="delFlag" type="hidden" value="1" name="delFlag"/>
  924. </div>
  925. </div>
  926. </div>
  927. </script>
  928. <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
  929. <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
  930. <script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
  931. <script type="text/javascript" src="${ctxStatic}/bootstrap-select/js/bootstrap-select.js"></script>
  932. <script type="text/javascript">
  933. $('#caimei').change(function () {
  934. var item = $('#caimei').val()
  935. console.log('item---'+item)
  936. var check = $(this).prop('checked')
  937. console.log('check---'+check)
  938. if (check) {
  939. $("#groundSkuCaimei").show(100)
  940. } else {
  941. $("#groundSkuCaimei").hide(100)
  942. }
  943. })
  944. $('#bcc').change(function () {
  945. var item = $('#bcc').val()
  946. console.log('item---'+item)
  947. var checkBcc = $(this).prop('checked')
  948. console.log('checkBcc---'+checkBcc)
  949. if (checkBcc) {
  950. $("#groundSkuBcc").show(100)
  951. } else {
  952. $("#groundSkuBcc").hide(100)
  953. }
  954. })
  955. /*$(function () {
  956. // debugger
  957. var productType= $("#productType").val();
  958. if (productType=="2"){
  959. $("#s2id_priceFlag").val(3);
  960. $("#s2id_visibility").val(4);
  961. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  962. $("#priceFlag").prev().find(".select2-chosen").text("仅对医美机构开放");
  963. $("#priceFlag").prop("disabled",true);
  964. $("#visibility").prop("disabled",true);
  965. }
  966. });*/
  967. //关键词联动
  968. function autocomplete(text) {
  969. // return ['三全鲜食(北新泾店)', 'Hot honey 首尔炸鸡(仙霞路)', '新旺角茶餐厅', '泷千家(天山西路店)', '胖仙女纸杯蛋糕(上海凌空店)', '贡茶', '豪大大香鸡排超级奶爸', '茶芝兰(奶茶,手抓饼)', '十二泷町', '星移浓缩咖啡', '阿姨奶茶/豪大大', '新麦甜四季甜品炸鸡', 'Monica摩托主题咖啡店', '浮生若茶(凌空soho店)', 'NONO JUICE 鲜榨果汁', 'CoCo都可(北新泾店)', '快乐柠檬(神州智慧店)', 'Merci Paul cafe', '猫山王(西郊百联店)', '枪会山', '纵食', '钱记', '壹杯加', '唦哇嘀咖', '爱茜茜里(西郊百联)', '爱茜茜里(近铁广场)', '鲜果榨汁(金沙江路和美广店)', '开心丽果(缤谷店)', '超级鸡车(丰庄路店)', '妙生活果园(北新泾店)', '香宜度麻辣香锅', '凡仔汉堡(老真北路店)', '港式小铺', '蜀香源麻辣香锅(剑河路店)', '北京饺子馆', '饭典*新简餐(凌空SOHO店)', '焦耳·川式快餐(金钟路店)', '动力鸡车', '浏阳蒸菜', '四海游龙(天山西路店)', '樱花食堂(凌空店)', '壹分米客家传统调制米粉(天山店)', '福荣祥烧腊(平溪路店)', '速记黄焖鸡米饭', '红辣椒麻辣烫', '(小杨生煎)西郊百联餐厅', '阳阳麻辣烫', '南拳妈妈龙虾盖浇饭'].filter(function (item) {
  970. // return text && item.indexOf(text) > -1;
  971. // });
  972. var keywordlist=new Array();
  973. <c:forEach items="${SearchFrequencyVo}" var="search">
  974. keywordlist.push("${search.keyword}")
  975. </c:forEach>
  976. return keywordlist.filter(function (item) {
  977. return text && item.indexOf(text) > -1;
  978. });
  979. }
  980. new AutoComplete({
  981. el: '.auto-input',
  982. callback: autocomplete,
  983. offsetLeft: -25
  984. });
  985. function js() {
  986. var val = $("#productType").val();
  987. var mac = $("#machineType").val();
  988. if (val == '2') {
  989. if (mac == '1') {
  990. // 械字号一类
  991. $("#visibility").val(3);
  992. $("#priceFlag").val(0);
  993. $("#commodityDetailsFlag").val(1);
  994. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  995. $("#priceFlag").prev().find(".select2-chosen").text("对所有机构公开");
  996. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("所有人可见");
  997. } else if (mac == '2') {
  998. // 械字号二类
  999. $("#visibility").val(3);
  1000. $("#priceFlag").val(3);
  1001. $("#commodityDetailsFlag").val(4);
  1002. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  1003. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  1004. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  1005. } else if (mac == '3') {
  1006. // 械字号三类
  1007. $("#visibility").val(3);
  1008. $("#priceFlag").val(3);
  1009. $("#commodityDetailsFlag").val(4);
  1010. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  1011. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  1012. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  1013. }
  1014. } else {
  1015. $("#priceFlag").prop("disabled", false);
  1016. $("#visibility").prop("disabled", false);
  1017. $("#commodityDetailsFlag").prop("disabled", false);
  1018. }
  1019. }
  1020. $('.costCheckFlag').on('change', function () {
  1021. var skus = $("#skus")
  1022. if ($(this).val() == 1) {
  1023. skus.each(function() {
  1024. skus.find('.sku-shopPercent').hide();
  1025. skus.find('.sku-costPrice').show();
  1026. })
  1027. //shopPercent.parent('.sku-shopPercent').hide();
  1028. //costPrice.parent('.sku-costPrice').show();
  1029. } else {
  1030. skus.each(function() {
  1031. skus.find('.sku-shopPercent').show();
  1032. skus.find('.sku-costPrice').hide();
  1033. })
  1034. // shopPercent.parent('.sku-shopPercent').show();
  1035. // costPrice.parent('.sku-costPrice').hide();
  1036. }
  1037. })
  1038. $('.mallCostCheckFlag').on('change', function () {
  1039. console.log('333333')
  1040. var mallSkus = $("#mallSkus")
  1041. if ($(this).val() == 1) {
  1042. mallSkus.each(function() {
  1043. mallSkus.find('.sku-shopPercent').hide(); // shopPercent.parent('.sku-shopPercent').hide();
  1044. mallSkus.find('.sku-costPrice').show();
  1045. })
  1046. } else {
  1047. mallSkus.each(function() {
  1048. mallSkus.find('.sku-shopPercent').show(); // shopPercent.parent('.sku-shopPercent').hide();
  1049. mallSkus.find('.sku-costPrice').hide();
  1050. })
  1051. // shopPercent.parent('.sku-shopPercent').show();
  1052. // costPrice.parent('.sku-costPrice').hide();
  1053. }
  1054. })
  1055. //富文本框编辑
  1056. function checkInfo() {
  1057. // debugger
  1058. var productType = $("#productType").val();
  1059. var qualificationNo = $('#qualificationNo').val()
  1060. var productName = $("#productName").val();
  1061. var qualificationTime = $('#qualificationTime').val()
  1062. var qualificationLink = $("#qualificationLink").val();
  1063. if (productType == "2") {
  1064. if (qualificationNo == null || qualificationNo == "") {
  1065. alertx("请输入证书编号");
  1066. return false;
  1067. }
  1068. if (productName == null || productName == "") {
  1069. alertx("请输入产品名称");
  1070. return false;
  1071. }
  1072. if (qualificationTime == null || qualificationTime == "") {
  1073. alertx("请输入证书有效时间");
  1074. return false;
  1075. }
  1076. if (qualificationLink == null || qualificationLink == "") {
  1077. alertx("请输入证书有效链接");
  1078. return false;
  1079. }
  1080. }
  1081. var detailInfo = detailInfoEditor.getData();
  1082. $("#detailInfo").val(detailInfo);
  1083. var commonDetailInfo = detailInfoEditor2.getData();
  1084. $("#commonDetailInfo").val(commonDetailInfo);
  1085. console.log(detailInfo);
  1086. var orderInfo = orderInfoEditor.getData();
  1087. $("#orderInfo").val(orderInfo);
  1088. console.log(orderInfo);
  1089. var serviceInfo = serviceInfoEditor.getData();
  1090. $("#serviceInfo").val(serviceInfo);
  1091. console.log(serviceInfo);
  1092. }
  1093. $(document).ready(function () {
  1094. $('body').on('keyup', '#wipeRemarks', function () {
  1095. $('#remarkLen').text($(this).val().length);
  1096. });
  1097. //$("#name").focus();
  1098. $("#inputForm").validate({
  1099. ignore: "",
  1100. submitHandler: function (form) {
  1101. var flag = true;
  1102. var shopId = $("#shopId").val()*1;
  1103. var commodityType = $("input[name='commodityType']:checked").val();
  1104. if (commodityType == '' || commodityType == null) {
  1105. alertx("请选择商品属性");
  1106. flag = false;
  1107. }
  1108. var groundMall = $("input[name='groundMall']:checked").val();
  1109. if (groundMall.length < 1) {
  1110. alertx("请选中上架平台");
  1111. flag = false;
  1112. }
  1113. var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  1114. var skus = $("#skus .sku")
  1115. skus.each(function() {
  1116. var cost = $(this)
  1117. if (costCheckFlag * 1 === 1) {
  1118. var costPrice = cost.find(".costPrice").val()
  1119. var organizeCostPrice = cost.find(".organizeCostPrice").val()
  1120. var cmCostPrice = cost.find(".cmCostPrice").val()
  1121. var price = cost.find(".computedPrice").val()*1
  1122. if (costPrice == '') {
  1123. alertx("请输入供应商成本价");
  1124. flag = false;
  1125. }
  1126. if (organizeCostPrice == '') {
  1127. alertx("请输入集团成本价");
  1128. flag = false;
  1129. }
  1130. if (cmCostPrice == '') {
  1131. alertx("请输入采美成本价");
  1132. flag = false;
  1133. }
  1134. const num = costPrice*1 + organizeCostPrice*1 + cmCostPrice*1
  1135. if (shopId != 1161 ) {
  1136. if (num != price) {
  1137. alertx("采美国定成本和需为机构价")
  1138. flag = false;
  1139. }
  1140. }else {
  1141. if (num > price) {
  1142. alertx("采美国定成本和不能大于机构价")
  1143. flag = false;
  1144. }
  1145. }
  1146. } else {
  1147. var shopPercent = cost.find(".shopPercent").val()
  1148. var organizePercent = cost.find(".organizePercent").val()
  1149. var cmPercent = cost.find(".cmPercent").val()
  1150. if (shopPercent == '') {
  1151. alertx("请输入成本比例");
  1152. flag = false;
  1153. }
  1154. if (organizePercent == '') {
  1155. alertx("请输入集团比例");
  1156. flag = false;
  1157. }
  1158. if (cmPercent == '') {
  1159. alertx("请输入供应商比例");
  1160. flag = false;
  1161. }
  1162. const num = shopPercent*1 + organizePercent*1 + cmPercent*1
  1163. if (shopId != 1161 ) {
  1164. if (num != 100) {
  1165. alertx("采美佣金比例和需为100")
  1166. flag = false;
  1167. }
  1168. }else {
  1169. if (num > 100) {
  1170. alertx("采美佣金比例和不能大于100")
  1171. flag = false;
  1172. }
  1173. }
  1174. }
  1175. })
  1176. var mallCostCheckFlag = $("input[name='mallCostCheckFlag']:checked").val();
  1177. var mallSkus = $("#mallSkus")
  1178. mallSkus.each(function() {
  1179. var mallCost = $(this)
  1180. if (mallCostCheckFlag * 1 === 1) {
  1181. var mallCostPrice = mallCost.find(".costPrice").val()
  1182. var mallOrganizeCostPrice = mallCost.find(".organizeCostPrice").val()
  1183. var mallCmCostPrice = mallCost.find(".cmCostPrice").val()
  1184. var mallprice = mallCost.find(".computedPrice").val()*1
  1185. if (mallCostPrice == '') {
  1186. alertx("请输入供应商成本价");
  1187. flag = false;
  1188. }
  1189. if (mallOrganizeCostPrice == '') {
  1190. alertx("请输入集团成本价");
  1191. flag = false;
  1192. }
  1193. if (mallCmCostPrice == '') {
  1194. alertx("请输入采美成本价");
  1195. flag = false;
  1196. }
  1197. const num = mallCostPrice*1 + mallOrganizeCostPrice*1 + mallCmCostPrice*1
  1198. if (shopId != 1161 ) {
  1199. if (num != mallprice) {
  1200. alertx("丽格国定成本和需为机构价");
  1201. flag = false;
  1202. }
  1203. } else {
  1204. if (num > mallprice) {
  1205. alertx("丽格国定成本和不能大于机构价")
  1206. flag = false;
  1207. }
  1208. }
  1209. } else {
  1210. var mallShopPercent = mallCost.find(".shopPercent").val()
  1211. var mallOrganizePercent = mallCost.find(".organizePercent").val()
  1212. var mallCmPercent = mallCost.find(".cmPercent").val()
  1213. if (mallShopPercent == '') {
  1214. alertx("请输入成本比例");
  1215. flag = false;
  1216. }
  1217. if (mallOrganizePercent == '') {
  1218. alertx("请输入集团比例");
  1219. flag = false;
  1220. }
  1221. if (mallCmPercent == '') {
  1222. alertx("请输入供应商比例");
  1223. flag = false;
  1224. }
  1225. const num = mallShopPercent*1 + mallOrganizePercent*1 + cmPercent*1
  1226. if (shopId != 1161 ) {
  1227. if (num != 100) {
  1228. alertx("丽格佣金比例和需为100");
  1229. flag = false;
  1230. }
  1231. } else {
  1232. if (num > 100) {
  1233. alertx("丽格佣金比例和不能大于100")
  1234. flag = false;
  1235. }
  1236. }
  1237. }
  1238. })
  1239. if ($('#minBuyNumber:visible').length > 0) {
  1240. var minBuyNumber = $('#minBuyNumber').val();
  1241. if (minBuyNumber <= 0 || minBuyNumber == '') {
  1242. alertx("请输入起订量");
  1243. flag = false;
  1244. }
  1245. }
  1246. if ($('input[name="ladderPriceList[0].buyNum"]:visible').length > 0) {
  1247. var buyNum = $('input[name="ladderPriceList[0].buyNum"]').val();
  1248. var buyPrice = $('input[name="ladderPriceList[0].buyPrice"]').val();
  1249. if (buyNum <= 0 || buyNum == '' || buyPrice <= 0 || buyPrice == '') {
  1250. alertx("请输入正确的阶梯价格");
  1251. flag = false;
  1252. }
  1253. }
  1254. if ($('input[name="ladderPriceList[1].buyNum"]:visible').length > 0) {
  1255. var buyNum1 = $('input[name="ladderPriceList[1].buyNum"]').val();
  1256. var buyPrice1 = $('input[name="ladderPriceList[1].buyPrice"]').val();
  1257. if (buyNum1 <= 0 || buyNum1 == '' || buyPrice1 <= 0 || buyPrice1 == '') {
  1258. alertx("请输入正确的阶梯价格");
  1259. flag = false;
  1260. }
  1261. }
  1262. if ($('input[name="ladderPriceList[2].buyNum"]:visible').length > 0) {
  1263. var buyNum2 = $('input[name="ladderPriceList[2].buyNum"]').val();
  1264. var buyPrice2 = $('input[name="ladderPriceList[2].buyPrice"]').val();
  1265. if (buyNum2 <= 0 || buyNum2 == '' || buyPrice2 <= 0 || buyPrice2 == '') {
  1266. alertx("请输入正确的阶梯价格");
  1267. flag = false;
  1268. }
  1269. }
  1270. var detailInfo = detailInfoEditor.getData();
  1271. if (detailInfo == '') {
  1272. alertx("请输入商品详细信息");
  1273. flag = false;
  1274. }
  1275. var includedTax = $("input[name='includedTax']:checked").val();
  1276. if (includedTax == '' || includedTax == null) {
  1277. alertx("请选择是否含税");
  1278. flag = false;
  1279. }
  1280. var invoiceType = $("input[name='invoiceType']:checked").val();
  1281. if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
  1282. var taxPoint = $("#taxPoint").val();
  1283. var supplierTaxPoint = $("#supplierTaxPoint").val();
  1284. if (taxPoint == '' || taxPoint == null) {
  1285. alertx("请输入机构税率");
  1286. flag = false;
  1287. }
  1288. if (supplierTaxPoint == '' || supplierTaxPoint == null) {
  1289. alertx("请输入供应商税率");
  1290. flag = false;
  1291. }
  1292. }
  1293. if (includedTax != ${product.includedTax} || invoiceType != ${product.invoiceType}) {
  1294. 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) {
  1295. if (v == 'ok') {
  1296. if(!$('#caimei').prop('checked')){
  1297. $("#groundSkuCaimei").remove()
  1298. }
  1299. if(!$('#bcc').prop('checked')){
  1300. $("#groundSkuBcc").remove()
  1301. }
  1302. // 提交订单
  1303. if (flag) {
  1304. loading('正在提交,请稍等...');
  1305. form.submit();
  1306. }
  1307. }
  1308. }, {
  1309. buttonsFocus: 1, closed: function () {
  1310. if (typeof closed == 'function') {
  1311. closed();
  1312. }
  1313. }
  1314. });
  1315. } else {
  1316. if(!$('#caimei').prop('checked')){
  1317. $("#groundSkuCaimei").remove()
  1318. }
  1319. if(!$('#bcc').prop('checked')){
  1320. $("#groundSkuBcc").remove()
  1321. }
  1322. if (flag) {
  1323. loading('正在提交,请稍等...');
  1324. form.submit();
  1325. }
  1326. }
  1327. },
  1328. errorContainer: "#messageBox",
  1329. errorPlacement: function (error, element) {
  1330. $("#messageBox").text("输入有误,请先更正。");
  1331. if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
  1332. error.appendTo(element.parent().parent());
  1333. } else {
  1334. error.insertAfter(element);
  1335. }
  1336. }
  1337. });
  1338. // 初始化上平台sku显示
  1339. if (-1 != groundMall.indexOf("0")) {
  1340. $('#caimei').attr('checked',true)
  1341. $('#groundSkuCaimei').show(100)
  1342. } else {
  1343. $('#groundSkuCaimei').hide(100)
  1344. }
  1345. if (-1 != groundMall.indexOf("4")) {
  1346. $('#bcc').attr('checked',true)
  1347. $('#groundSkuBcc').show(100)
  1348. } else {
  1349. $('#groundSkuBcc').hide(100)
  1350. }
  1351. // 初始化sku
  1352. insertDefaultSkuRow();
  1353. // 初始化外部商城sku
  1354. insertDefaultMallSkuRow();
  1355. // 初始化关联标签库
  1356. initLabelSelects();
  1357. });
  1358. function initLabelSelects(){
  1359. var labelSelectBox = $('#labelSelectBox');
  1360. labelSelectBox.selectpicker({
  1361. liveSearch: true,
  1362. noneSelectedText: '请选择标签库',
  1363. maxOptions: 6,
  1364. maxOptionsText: '最多选取6个标签库'
  1365. });
  1366. // 回显操作
  1367. var str = '${product.labelIds}';
  1368. if(!str) return;
  1369. var arr = str.split(',');
  1370. console.log(arr);
  1371. labelSelectBox.selectpicker('val', arr);
  1372. }
  1373. <%--// 商品可见度--%>
  1374. <%--/*$(function() {--%>
  1375. <%-- var initValue = ${(product.visibility <= 0) ? 3 : ((product.visibility >= 3) ? 3 : product.visibility)}--%>
  1376. <%-- var select = $("#visibility");--%>
  1377. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1378. <%-- min: 1,--%>
  1379. <%-- max: 3,--%>
  1380. <%-- range: "min",--%>
  1381. <%-- value: initValue,--%>
  1382. <%-- slide: function(event, ui) {--%>
  1383. <%-- if (ui.value*1 === 1){--%>
  1384. <%-- // 所有可见--%>
  1385. <%-- select.val(1);--%>
  1386. <%-- } else if (ui.value*1 === 2){--%>
  1387. <%-- // 会员可见--%>
  1388. <%-- select.val(2);--%>
  1389. <%-- } else{--%>
  1390. <%-- // 不可见--%>
  1391. <%-- select.val(3);--%>
  1392. <%-- }--%>
  1393. <%-- $("#visibilityNote").text(select.find("option:selected").text());--%>
  1394. <%-- }--%>
  1395. <%-- });--%>
  1396. <%--});*/--%>
  1397. <%--// 价格可见度: 1不公开价格,3仅对医美机构公开,2仅对会员机构公开,0公开价格--%>
  1398. <%--// 对应滑块:1->2->3->4--%>
  1399. <%--$(function() {--%>
  1400. <%-- var initValue = ${(product.priceFlag eq 0) ? 2 : ((product.priceFlag eq 2) ? 1 : 0)}--%>
  1401. <%-- var initValue = ${(product.priceFlag eq 1) ? 1 : ((product.priceFlag eq 3) ? 2 : ((product.priceFlag eq 2) ? 3 : 4))}--%>
  1402. <%-- var select = $("#priceFlag");--%>
  1403. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1404. <%-- min: 1,--%>
  1405. <%-- max: 4,--%>
  1406. <%-- range: "min",--%>
  1407. <%-- value: initValue,--%>
  1408. <%-- slide: function(event, ui) {--%>
  1409. <%-- if (ui.value*1 === 4){--%>
  1410. <%-- // 所有可见--%>
  1411. <%-- select.val(0);--%>
  1412. <%-- } else if (ui.value*1 === 3){--%>
  1413. <%-- // 会员可见--%>
  1414. <%-- select.val(2);--%>
  1415. <%-- } else if (ui.value*1 === 2){--%>
  1416. <%-- // 医美可见--%>
  1417. <%-- select.val(3);--%>
  1418. <%-- } else{--%>
  1419. <%-- // 不可见--%>
  1420. <%-- select.val(1);--%>
  1421. <%-- }--%>
  1422. <%-- //select[0].selectedIndex = ui.value;--%>
  1423. <%-- $("#textFlagNote").text(select.find("option:selected").text());--%>
  1424. <%-- }--%>
  1425. <%-- });--%>
  1426. <%--});--%>
  1427. function getCodes(data) {
  1428. var opts = "<option value=''>请选择</option>";
  1429. $.ajax({
  1430. type: "POST",
  1431. url: "${ctx}/product/new/getCodes",
  1432. data: {"shopId": data},
  1433. success: function (res) {
  1434. console.log("data------------------->" + res)
  1435. for (let i = 0; i < res.length; i++) {
  1436. opts += "<option value='" + res[i].splitCode + "'>" + res[i].codeName + "</option>";
  1437. }
  1438. console.log(opts);
  1439. $("#getCode").html('').append(opts);
  1440. },
  1441. error: function (res) {
  1442. }
  1443. });
  1444. }
  1445. //图片初始化
  1446. if (${product.shopType == 2}) {
  1447. $(function () {
  1448. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  1449. var realLength = 0;
  1450. var maxChange = "1";
  1451. for (var i = 0; i < str.length; i++) {
  1452. charCode = str.charCodeAt(i);
  1453. if (charCode >= 0 && charCode <= 128)
  1454. realLength += 1;
  1455. else {
  1456. realLength += 2;
  1457. maxChange = "2";
  1458. }
  1459. }
  1460. if (maxChange == "2") {
  1461. var s = str.substr(0, 16);
  1462. $(searckThis).val(s);
  1463. }
  1464. if (realLength > maxlength) {
  1465. alertx("关键字最多16个汉字,即32个字符!");
  1466. }
  1467. }
  1468. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1469. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  1470. $('.upload-content .conList').find('.cancel-upload').hide();
  1471. var observeEle = document.getElementsByClassName('upload-content')[0];
  1472. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  1473. var MutationObserverConfig = {
  1474. childList: true,
  1475. subtree: true,
  1476. characterData: true
  1477. };
  1478. var observer = new MutationObserver(function (mutations) {
  1479. $.each(mutations, function (index, item) {
  1480. if (item.type === 'childList') {
  1481. // 在创建新的 element 时调用
  1482. var target = $(item.target),
  1483. thisWrapper = target.closest('.conList'),
  1484. nextEle = thisWrapper.next();
  1485. thisWrapper.find('li').css('z-index', 99);
  1486. thisWrapper.find('.cancel-upload').show();
  1487. if (nextEle.hasClass('hide-pic')) {
  1488. nextEle.removeClass('hide-pic');
  1489. }
  1490. }
  1491. })
  1492. });
  1493. observer.observe(observeEle, MutationObserverConfig);
  1494. $('body').on('click', '.upload-content li', function () {
  1495. var index = $(this).closest('.conList').index() + 1,
  1496. str = 'image' + index + 'FinderOpen';
  1497. eval(str + '()');
  1498. });
  1499. $('body').on('click', '.cancel-upload', function () {
  1500. var wrapper = $(this).closest('.conList');
  1501. wrapper.find('li').css('z-index', '-1');
  1502. wrapper.find('input').val('');
  1503. $(this).hide();
  1504. if ($('.cancel-upload:visible').length < 5) {
  1505. wrapper.addClass("hide-pic");
  1506. } else {
  1507. wrapper.removeClass("hide-pic");
  1508. }
  1509. wrapper.parent().append(wrapper.clone());
  1510. wrapper.remove();
  1511. $(".conList").each(function (i, ele) {
  1512. if ($(ele).find("input.input-xlarge").val()) {
  1513. $(ele).next().removeClass("hide-pic")
  1514. }
  1515. })
  1516. });
  1517. $(window).on("load", function () {
  1518. setTimeout(function () {
  1519. $("#secondHandImage").find("input.input-xlarge").each(function (i, ele) {
  1520. if ($(ele).val()) {
  1521. $(ele).next().find("li").css("z-index", "99");
  1522. $(ele).parents(".conList").find(".cancel-upload").show();
  1523. $(ele).parents(".conList").next().removeClass("hide-pic")
  1524. }
  1525. })
  1526. }, 500);
  1527. });
  1528. $('.upload-content-image .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1529. $('.upload-content-image .conList .btn:nth-of-type(2)').after('<img class="cancel-upload-image" src="/static/images/close-btn1.png">').remove();
  1530. $('.upload-content-image .conList').find('.cancel-upload-image').hide();
  1531. var observeEleImage = document.getElementsByClassName('upload-content-image')[0];
  1532. // var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
  1533. var MutationObserverImage = window.MutationObserver || window.WebKitMutationObserver;
  1534. var MutationObserverConfigImage = {
  1535. childList: true,
  1536. subtree: true,
  1537. characterData: true
  1538. };
  1539. var observerImage = new MutationObserverImage(function (mutations) {
  1540. $.each(mutations, function (index, item) {
  1541. if (item.type === 'childList') {
  1542. // 在创建新的 element 时调用
  1543. var target = $(item.target),
  1544. thisWrapper = target.closest('.conList'),
  1545. nextEle = thisWrapper.next();
  1546. thisWrapper.find('li').css('z-index', 99);
  1547. thisWrapper.find('.cancel-upload-image').show();
  1548. if (nextEle.hasClass('hide-pic-image')) {
  1549. nextEle.removeClass('hide-pic-image');
  1550. }
  1551. }
  1552. });
  1553. });
  1554. // observerImage.observe(observeEleImage, MutationObserverConfigImage);
  1555. // observerImage.observe(observeEleImage1, MutationObserverConfigImage);
  1556. $('body').on('click', '.upload-content-image li', function () {
  1557. var index = $(this).closest('.conList').index() + 1,
  1558. str = 'remarkImage' + index + 'FinderOpen';
  1559. eval(str + '()');
  1560. });
  1561. $('body').on('click', '.cancel-upload-image', function () {
  1562. var wrapper = $(this).closest('.conList');
  1563. wrapper.find('li').css('z-index', '-1');
  1564. wrapper.find('input').val('');
  1565. $(this).hide();
  1566. wrapper.removeClass("hide-pic-image");
  1567. wrapper.parent().append(wrapper.clone());
  1568. wrapper.remove();
  1569. $(".conList").each(function (i, ele) {
  1570. if ($(ele).find("input.input-xlarge").val()) {
  1571. $(ele).next().removeClass("hide-pic-image")
  1572. }
  1573. })
  1574. });
  1575. });
  1576. }
  1577. /**
  1578. * @param obj
  1579. * jquery控制input只能输入数字和两位小数
  1580. */
  1581. function num(obj) {
  1582. obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
  1583. obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
  1584. obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
  1585. obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  1586. obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
  1587. }
  1588. //初始化标签
  1589. $(function () {
  1590. // debugger
  1591. var html = '';
  1592. //解析参数
  1593. var tagsLists = $("#tagsLists").val();
  1594. if (tagsLists != null && tagsLists != "") {
  1595. var tagsArray = tagsLists.split(',');
  1596. for (var j = 0; j < tagsArray.length; j++) {
  1597. html += '<div class="tags-li"><input id="tags" name="tags" value="' + tagsArray[j] + '" class="tags-s" readonly/><i onclick="removerX(this)">X</i></div>';
  1598. }
  1599. $("#tagsList").append(html).show();
  1600. }
  1601. });
  1602. $(window).load(function () {
  1603. loadInitType();
  1604. });
  1605. var step = ${product.step};
  1606. var areaFlag = ${product.allAreaFlag};
  1607. <%--var ladderPriceFlag = ${product.ladderPriceFlag};--%>
  1608. <%--var normalPrice = ${product.price};--%>
  1609. $(document).ready(function () {
  1610. step * 1 > 1 ? $("#setpInput").show() : $("#setpInput").hide();
  1611. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1612. // computedPriceLevel(normalPrice);
  1613. // if (ladderPriceFlag * 1 > 0) {
  1614. // $("#ladderPriceBox").show();
  1615. // $("#priceMinNumber").hide();
  1616. // } else {
  1617. // $("#ladderPriceBox").hide();
  1618. // $("#priceMinNumber").show();
  1619. // }
  1620. // changeCostPriceShow();
  1621. //富文本框
  1622. ClassicEditor.create(document.querySelector('#detailInfoEditor'), {
  1623. ckfinder: {
  1624. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1625. }
  1626. }).then(function (editor) {
  1627. window.detailInfoEditor = editor;
  1628. }).catch(function (error) {
  1629. console.log(error);
  1630. });
  1631. //富文本框
  1632. ClassicEditor.create(document.querySelector('#detailInfoEditor2'), {
  1633. ckfinder: {
  1634. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1635. }
  1636. }).then(function (editor) {
  1637. window.detailInfoEditor2 = editor;
  1638. }).catch(function (error) {
  1639. console.log(error);
  1640. });
  1641. ClassicEditor.create(document.querySelector('#orderInfoEditor'), {
  1642. ckfinder: {
  1643. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1644. }
  1645. }).then(function (editor) {
  1646. window.orderInfoEditor = editor;
  1647. }).catch(function (error) {
  1648. console.log(error);
  1649. });
  1650. ClassicEditor.create(document.querySelector('#serviceInfoEditor'), {
  1651. ckfinder: {
  1652. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1653. }
  1654. }).then(function (editor) {
  1655. window.serviceInfoEditor = editor;
  1656. }).catch(function (error) {
  1657. console.log(error);
  1658. });
  1659. });
  1660. // $("#ladderPrice1").on("click", ".addBtn", function () {
  1661. // $("#ladderPrice2").removeClass("hide");
  1662. // $("#delFlag2").val("0");
  1663. // $("#ladderPrice1").find(".showBtn").addClass("hide");
  1664. // });
  1665. // $("#ladderPrice2").on("click", ".addBtn", function () {
  1666. // $("#ladderPrice3").removeClass("hide");
  1667. // $("#delFlag3").val("0");
  1668. // $("#ladderPrice2").find(".showBtn").addClass("hide");
  1669. // }).on("click", ".delBtn", function () {
  1670. // $("#ladderPrice2").addClass("hide");
  1671. // $("#ladderPrice1").find(".showBtn").removeClass("hide");
  1672. // $("#delFlag2").val("1");
  1673. // });
  1674. // $("#ladderPrice3").on("click", ".delBtn", function () {
  1675. // $("#ladderPrice3").addClass("hide");
  1676. // $("#ladderPrice2").find(".showBtn").removeClass("hide");
  1677. // $("#delFlag3").val("1");
  1678. // });
  1679. //计算游客用户价格等级
  1680. function computedPriceLevel(price) {
  1681. var priceLevel = 1;
  1682. $(".priceIcon").removeClass("full");
  1683. $(".priceIcon").eq(0).addClass("full");
  1684. if (price * 1 > 2.5 * 10000 && price * 1 <= 10 * 10000) {
  1685. priceLevel = 2;
  1686. $(".priceIcon").addClass("full");
  1687. if ($(".priceIcon").eq(2).hasClass("full")) {
  1688. $(".priceIcon").eq(2).removeClass("full");
  1689. }
  1690. if ($(".priceIcon").eq(3).hasClass("full")) {
  1691. $(".priceIcon").eq(3).removeClass("full");
  1692. }
  1693. if ($(".priceIcon").eq(4).hasClass("full")) {
  1694. $(".priceIcon").eq(4).removeClass("full");
  1695. }
  1696. }
  1697. if (price * 1 > 10 * 10000 && price * 1 <= 25 * 10000) {
  1698. priceLevel = 3;
  1699. $(".priceIcon").addClass("full");
  1700. if ($(".priceIcon").eq(3).hasClass("full")) {
  1701. $(".priceIcon").eq(3).removeClass("full");
  1702. }
  1703. if ($(".priceIcon").eq(4).hasClass("full")) {
  1704. $(".priceIcon").eq(4).removeClass("full");
  1705. }
  1706. }
  1707. if (price * 1 > 25 * 10000 && price * 1 <= 50 * 10000) {
  1708. priceLevel = 4;
  1709. $(".priceIcon").addClass("full");
  1710. if ($(".priceIcon").eq(4).hasClass("full")) {
  1711. $(".priceIcon").eq(4).removeClass("full");
  1712. }
  1713. }
  1714. if (price * 1 > 50 * 10000) {
  1715. priceLevel = 5;
  1716. $(".priceIcon").addClass("full");
  1717. }
  1718. }
  1719. // 检查阶梯数量
  1720. // function checkBuyNum(input, index) {
  1721. // if (index > 0) {
  1722. // var beforeNum = $('input[name="ladderPriceList[' + (index - 1) + '].buyNum"]').val() * 1;
  1723. // if (input.value * 1 <= beforeNum) {
  1724. // alertx("请输入大于上一阶起订量的值");
  1725. // $(input).val(input.value * 1 + beforeNum);
  1726. // }
  1727. // } else {
  1728. // var minNum = $('input[name="ladderPriceList[0].buyNum"]').val() * 1;
  1729. // $('#minBuyNumber').val(minNum);
  1730. // }
  1731. // }
  1732. // 检查阶梯价格
  1733. // function checkBuyPrice(input, index) {
  1734. // if (index > 0) {
  1735. // var beforePrice = $('input[name="ladderPriceList[' + (index - 1) + '].buyPrice"]').val() * 1;
  1736. // if (input.value * 1 > beforePrice) {
  1737. // $(input).val('');
  1738. // alertx("请输入小于前一个价格的值");
  1739. // }
  1740. // } else {
  1741. // var price = $('#price').val();
  1742. // if (input.value * 1 > price) {
  1743. // $(input).val('');
  1744. // alertx("第一个阶梯价格不能大于机构价");
  1745. // }
  1746. // }
  1747. // }
  1748. // 是否使用阶梯价格
  1749. function changeLadderPrice() {
  1750. var ladderPriceFlag = $("input[name='ladderPriceFlag']:checked").val();
  1751. var svipFlag = ${product.svipFlag};
  1752. if (svipFlag == 1) {
  1753. alertx("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
  1754. $("input[name='ladderPriceFlag']").get(0).checked = true;
  1755. } else {
  1756. if (ladderPriceFlag * 1 > 0) {
  1757. $("#ladderPriceBox").show();
  1758. $("#priceMinNumber").hide();
  1759. $("#delFlag1").val("0");
  1760. $('input[name="ladderPriceList[0].buyNum"]').val($('#minBuyNumber').val() * 1);
  1761. } else {
  1762. $("#ladderPriceBox").hide();
  1763. $("#priceMinNumber").show();
  1764. }
  1765. }
  1766. }
  1767. // 是否固定成本
  1768. // function changeCostPriceShow() {
  1769. // var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  1770. // if (costCheckFlag * 1 === 1) {
  1771. // $("#costPriceShow").show();
  1772. // $("#costPropShow").hide();
  1773. // } else {
  1774. // $("#costPriceShow").hide();
  1775. // $("#costPropShow").show();
  1776. // }
  1777. // }
  1778. // 全部区域
  1779. function changeAreaFlag() {
  1780. var areaFlag = $("input[name='allAreaFlag']:checked").val();
  1781. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1782. }
  1783. // 网站分类
  1784. var currentBigtype = ${product.bigTypeID};
  1785. var currentSmalltype = ${product.smallTypeID};
  1786. var currentTinytype = ${product.tinyTypeID};
  1787. var currentCommodityType = ${product.commodityType}; //商品属性
  1788. var bigTypeList = [
  1789. <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
  1790. <c:if test="${index.index > 0}">, </c:if>
  1791. {
  1792. bigTypeID: ${bigType.bigTypeID},
  1793. name: "${bigType.name}",
  1794. typeSort: ${bigType.typeSort}
  1795. }
  1796. </c:forEach>
  1797. ];
  1798. var smalltypeList = [
  1799. <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
  1800. <c:if test="${index.index > 0}">, </c:if>
  1801. {
  1802. smallTypeID: ${smalltype.smallTypeID},
  1803. name: "${smalltype.name}",
  1804. bigTypeID: ${smalltype.bigTypeID},
  1805. }
  1806. </c:forEach>
  1807. ];
  1808. var tinytypeList = [
  1809. <c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
  1810. <c:if test="${index.index > 0}">, </c:if>
  1811. {
  1812. tinyTypeID: ${tinytype.tinyTypeID},
  1813. name: "${tinytype.name}",
  1814. smallTypeID: ${tinytype.smallTypeID}
  1815. }
  1816. </c:forEach>
  1817. ];
  1818. // 初始分类
  1819. function loadInitType() {
  1820. if (currentCommodityType == null || typeof (currentCommodityType) == "undefined" || currentCommodityType == '0') {
  1821. $("#bigType").html("");
  1822. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1823. $("#bigType").append("<option value=''>请选择</option>");
  1824. $("#smallType").html("");
  1825. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1826. $("#smallType").append("<option value=''>请选择</option>");
  1827. $("#tinyType").html("");
  1828. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1829. $("#tinyType").append("<option value=''>请选择</option>");
  1830. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1831. } else if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
  1832. setTimeout(function () {
  1833. loadBigType();
  1834. }, 0);
  1835. }
  1836. }
  1837. // 分类联动
  1838. function loadBigType() {
  1839. var commodityType = $("input[name='commodityType']:checked").val();
  1840. $("#bigType").html("");
  1841. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1842. $("#bigType").append("<option value=''>请选择</option>");
  1843. $("#smallType").html("");
  1844. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1845. $("#smallType").append("<option value=''>请选择</option>");
  1846. $("#tinyType").html("");
  1847. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1848. $("#tinyType").append("<option value=''>请选择</option>");
  1849. if (typeof (commodityType) != "undefined") {
  1850. $("#bigType").html("");
  1851. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1852. $("#bigType").append("<option value=''>请选择</option>");
  1853. $("#smallType").html("");
  1854. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1855. $("#smallType").append("<option value=''>请选择</option>");
  1856. $("#tinyType").html("");
  1857. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1858. $("#tinyType").append("<option value=''>请选择</option>");
  1859. for (var i = 0; i < bigTypeList.length; i++) {
  1860. if (commodityType == bigTypeList[i].typeSort) {
  1861. if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeID) {
  1862. $("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1863. $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
  1864. setTimeout(function () {
  1865. loadSmallType();
  1866. }, 500);
  1867. } else {
  1868. $("#bigType").append("<option value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1869. }
  1870. }
  1871. }
  1872. }
  1873. loadSmallType();
  1874. trainingShow();
  1875. }
  1876. var conn=0;
  1877. var insertStatus='${product.insertStatus}';
  1878. function loadSmallType(id) {
  1879. if (id) {
  1880. $("#bigType").val(id);
  1881. $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
  1882. }
  1883. var bigType = $("#bigType").val();
  1884. $("#smallType").html("");
  1885. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1886. $("#smallType").append("<option value=''>请选择</option>");
  1887. $("#tinyType").html("");
  1888. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1889. $("#tinyType").append("<option value=''>请选择</option>");
  1890. if (typeof (bigType) != "undefined" && bigType != "") {
  1891. var smallTypeNum = 0;
  1892. for (var i = 0; i < smalltypeList.length; i++) {
  1893. if (bigType == smalltypeList[i].bigTypeID) {
  1894. smallTypeNum = smallTypeNum + 1;
  1895. if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
  1896. $("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1897. $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
  1898. setTimeout(function () {
  1899. loadTinyType(currentSmalltype);
  1900. // loadGoods();
  1901. }, 500);
  1902. } else {
  1903. $("#smallType").append("<option value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1904. }
  1905. }
  1906. }
  1907. if (smallTypeNum == 0) {
  1908. $("#smallType").removeClass("required");
  1909. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1910. } else {
  1911. $("#smallType").addClass("required");
  1912. document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
  1913. }
  1914. } else {
  1915. $("#smallType").removeClass("required");
  1916. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1917. }
  1918. loadTinyType();
  1919. if(insertStatus==1){
  1920. conn=1;
  1921. loadGoods(conn);
  1922. insertStatus++;
  1923. }else{
  1924. loadGoods(conn);
  1925. }
  1926. }
  1927. function loadTinyType(id) {
  1928. if (id) {
  1929. $("#smallType").val(id);
  1930. $("#smallType").prev().find(".select2-chosen").text($("#smallType option:selected").text());
  1931. }
  1932. var smallType = $("#smallType option:selected").val();
  1933. $("#tinyType").html("");
  1934. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1935. $("#tinyType").append("<option value=''>请选择</option>");
  1936. if (typeof (smallType) != "undefined" && smallType != "") {
  1937. var tinyTypeNum = 0;
  1938. for (var i = 0; i < tinytypeList.length; i++) {
  1939. if (smallType == tinytypeList[i].smallTypeID) {
  1940. tinyTypeNum = tinyTypeNum + 1;
  1941. if (currentTinytype != null && typeof (currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
  1942. $("#tinyType").append("<option selected value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1943. $("#tinyType").prev().find(".select2-chosen").text(tinytypeList[i].name);
  1944. } else {
  1945. $("#tinyType").append("<option value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1946. }
  1947. }
  1948. }
  1949. if (tinyTypeNum == 0) {
  1950. $("#tinyType").removeClass("required");
  1951. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1952. } else {
  1953. $("#tinyType").addClass("required");
  1954. document.getElementById("s2id_tinyType").style.cssText = "display: inline-block";
  1955. }
  1956. } else {
  1957. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1958. $("#tinyType").removeClass("required");
  1959. }
  1960. }
  1961. function loadGoods(id){
  1962. var bigType=null;
  1963. if(id==1){
  1964. if(typeof (bigType) != "undefined" && bigType != ""){
  1965. bigType='${product.returnGoodsStutas}'
  1966. $("#goods").html("");
  1967. $("#goods").prev().find(".select2-chosen").text("请选择");
  1968. $("#goods").append("<option value=''>请选择</option>");
  1969. var not='不能';
  1970. var ye='能';
  1971. if(bigType=='2'){
  1972. $("#goods").append("<option value='1'>" + '能' + "</option>");
  1973. $("#goods").append("<option selected value='2'>" + not + "</option>");
  1974. $("#goods").prev().find(".select2-chosen").text(not);
  1975. }else{
  1976. $("#goods").append("<option selected value='1'>" + ye + "</option>");
  1977. $("#goods").append("<option value='2'>" + '不能' + "</option>");
  1978. $("#goods").prev().find(".select2-chosen").text(ye);
  1979. }
  1980. }
  1981. }else{
  1982. if(typeof (bigType) != "undefined" && bigType != ""){
  1983. bigType = $("#bigType").val();
  1984. $("#goods").html("");
  1985. $("#goods").prev().find(".select2-chosen").text("请选择");
  1986. $("#goods").append("<option value=''>请选择</option>");
  1987. var not='不能';
  1988. var ye='能';
  1989. if(bigType=='1014'||bigType=='1016'||bigType=='1021'||bigType=='1023'){
  1990. $("#goods").append("<option value='1'>" + '能' + "</option>");
  1991. $("#goods").append("<option selected value='2'>" + not + "</option>");
  1992. $("#goods").prev().find(".select2-chosen").text(not);
  1993. }else{
  1994. $("#goods").append("<option selected value='1'>" + ye + "</option>");
  1995. $("#goods").append("<option value='2'>" + '不能' + "</option>");
  1996. $("#goods").prev().find(".select2-chosen").text(ye);
  1997. }
  1998. }
  1999. }
  2000. conn++;
  2001. }
  2002. <%--window.onload=function () {--%>
  2003. <%-- console.log('-----------------------onload')--%>
  2004. <%-- $("#goods").val('${product.returnGoodsStutas}')--%>
  2005. <%--}--%>
  2006. //验证字符串最大长度
  2007. function checkmaxlength(str) {
  2008. var realLength = 0;
  2009. for (var i = 0; i < str.length; i++) {
  2010. charCode = str.charCodeAt(i);
  2011. if (charCode >= 0 && charCode <= 128)
  2012. realLength += 1;
  2013. else
  2014. realLength += 2;
  2015. }
  2016. if (realLength > 100) {
  2017. alertx("商品名称最多50个汉字,即100个字符!当前输入长度为" + realLength);
  2018. }
  2019. }
  2020. //验证字符串最大长度
  2021. function checkmaxlengths(str, maxlength) {
  2022. var realLength = 0;
  2023. for (var i = 0; i < str.length; i++) {
  2024. charCode = str.charCodeAt(i);
  2025. if (charCode >= 0 && charCode <= 128)
  2026. realLength += 1;
  2027. else
  2028. realLength += 2;
  2029. }
  2030. if (realLength > maxlength) {
  2031. alertx("商品名称最多30个汉字,即60个字符!当前输入长度为" + realLength);
  2032. }
  2033. }
  2034. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  2035. var realLength = 0;
  2036. var maxChange = "1";
  2037. for (var i = 0; i < str.length; i++) {
  2038. charCode = str.charCodeAt(i);
  2039. if (charCode >= 0 && charCode <= 128)
  2040. realLength += 1;
  2041. else {
  2042. realLength += 2;
  2043. maxChange = "2";
  2044. }
  2045. }
  2046. if (maxChange == "2") {
  2047. var s = str.substr(0, 16);
  2048. $(searckThis).val(s);
  2049. }
  2050. if (realLength > maxlength) {
  2051. alertx("关键字最多16个汉字,即32个字符!");
  2052. }
  2053. }
  2054. function checkPrecisehKeyLength(str) {
  2055. var realLength = 0;
  2056. for (var i = 0; i < str.length; i++) {
  2057. charCode = str.charCodeAt(i);
  2058. if (charCode >= 0 && charCode <= 128)
  2059. realLength += 1;
  2060. else
  2061. realLength += 2;
  2062. }
  2063. if (realLength > 160) {
  2064. alertx("精确关键词最多80个汉字,即160个字符!当前输入长度为" + realLength);
  2065. }
  2066. }
  2067. var skuIndex = 0;
  2068. var productJson = ${productJson};
  2069. console.log("productJson",productJson);
  2070. var skuList = productJson.skuList;
  2071. var mallSkuList = productJson.mallSkuList;
  2072. var groundMall = productJson.groundMall;
  2073. console.log("groundMall",groundMall)
  2074. if (skuList === undefined) {
  2075. skuList = ""
  2076. }
  2077. if (mallSkuList === undefined) {
  2078. mallSkuList = ""
  2079. }
  2080. $(".addSku").click(function () {
  2081. var skuTemplate = $('#skuTemplate').html()
  2082. $("#skus").append(skuTemplate).show();
  2083. var current = $("#skus").find('.sku').eq(-1);
  2084. if(skuList.length>0 || mallSkuList.length >0){
  2085. skuIndexNum = ++skuIndex;
  2086. }else{
  2087. skuIndexNum = 0;
  2088. }
  2089. var product = {
  2090. skuIndex: ++skuIndex-1,
  2091. costCheckFlag: '1',
  2092. ladderPriceFlag: '0'
  2093. }
  2094. setSkuPrototypeValues(current, product, 0);
  2095. skuEventBind(current, product);
  2096. })
  2097. $(".addMallSku").click(function () {
  2098. var skuTemplate = $('#skuTemplate').html()
  2099. $("#mallSkus").append(skuTemplate).show();
  2100. var current = $("#mallSkus").find('.sku').eq(-1);
  2101. if(skuList.length>0 || mallSkuList.length >0){
  2102. skuIndexNum = ++skuIndex;
  2103. }else{
  2104. skuIndexNum = 0;
  2105. }
  2106. var product = {
  2107. skuIndex: ++skuIndex-1,
  2108. costCheckFlag: '1',
  2109. ladderPriceFlag: '0'
  2110. }
  2111. setSkuPrototypeValues(current, product, 4);
  2112. skuEventBind(current, product);
  2113. })
  2114. function deleteDiv(el){
  2115. el.parentNode.parentNode.parentNode.parentNode.removeChild(el.parentNode.parentNode.parentNode);
  2116. }
  2117. function insertDefaultSkuRow() {
  2118. console.log('skuList', skuList);
  2119. if (skuList) {
  2120. for (var i = 0; i < skuList.length; i++) {
  2121. var skuTemplate = $('#skuTemplate').html();
  2122. $("#skus").append(skuTemplate).show();
  2123. var current = $("#skus").find('.sku').eq(-1);
  2124. var product = skuList[i];
  2125. product.skuIndex = i;
  2126. setSkuPrototypeValues(current, product, product.organizeId);
  2127. skuEventBind(current, product);
  2128. skuIndex = i
  2129. }
  2130. } else {
  2131. $("#skus").hide();
  2132. }
  2133. // else {
  2134. // var product = {};
  2135. // product.skuIndex = 0;
  2136. // setSkuPrototypeValues(current, product);
  2137. // skuEventBind(current, product);
  2138. // }
  2139. }
  2140. function insertDefaultMallSkuRow() {
  2141. console.log('mallSkuList', mallSkuList);
  2142. if (mallSkuList) {
  2143. for (var i = skuList.length; i < mallSkuList.length+skuList.length; i++) {
  2144. var skuTemplate = $('#skuTemplate').html();
  2145. $("#mallSkus").append(skuTemplate).show();
  2146. var current = $("#mallSkus").find('.sku').eq(-1);
  2147. var product = mallSkuList[i-skuList.length];
  2148. product.skuIndex = i;
  2149. setSkuPrototypeValues(current, product, product.organizeId);
  2150. skuEventBind(current, product);
  2151. skuIndex = i
  2152. }
  2153. } else {
  2154. $("#mallSkus").hide();
  2155. }
  2156. // else {
  2157. // var product = {};
  2158. // product.skuIndex = 0;
  2159. // setSkuPrototypeValues(current, product);
  2160. // skuEventBind(current, product);
  2161. // }
  2162. }
  2163. /* 设置新增sku属性值 */
  2164. function setSkuPrototypeValues(el, product, organize) {
  2165. console.log(product);
  2166. if (!product) return;
  2167. var skuIndex = product.skuIndex;
  2168. var organizeId = el.find('input[name$="organizeId"]');
  2169. organizeId.val(organize)
  2170. organizeId.attr('name', 'skuList[' + skuIndex + '].organizeId');
  2171. var mallProductId = el.find('input[name$="mallProductId"]');
  2172. mallProductId.val(product.mallProductId)
  2173. mallProductId.attr('name', 'skuList[' + skuIndex + '].mallProductId');
  2174. var index = el.find('input[name$="index"]');
  2175. index.val(skuIndex);
  2176. if(product.skuId){
  2177. var skuId=el.find('input[name$="skuId"]');
  2178. skuId.val(product.skuId);
  2179. skuId.attr('name', 'skuList[' + skuIndex + '].skuId');
  2180. }
  2181. // 包装规格
  2182. var unit = el.find('input[name$="unit"]');
  2183. unit.val(product.unit)
  2184. unit.attr('name', 'skuList[' + skuIndex + '].unit');
  2185. // 市场价
  2186. var normalPrice = el.find('input[name$="normalPrice"]');
  2187. normalPrice.val(product.normalPrice)
  2188. normalPrice.attr('name', 'skuList[' + skuIndex + '].normalPrice');
  2189. // 库存
  2190. var stock = el.find('input[name$="stock"]');
  2191. stock.val(product.stock)
  2192. stock.attr('name', 'skuList[' + skuIndex + '].stock');
  2193. // 成本
  2194. var costCheckFlag = el.find('input[name$="costCheckFlag"]');
  2195. costCheckFlag.attr('name', 'skuList[' + skuIndex + '].costCheckFlag');
  2196. costCheckFlag.eq(0).attr('checked', product.costCheckFlag == 1);
  2197. costCheckFlag.eq(1).attr('checked', product.costCheckFlag != 1);
  2198. // 成本价
  2199. var costPrice = el.find('input[name$="costPrice"]');
  2200. costPrice.val(product.costPrice)
  2201. costPrice.attr('name', 'skuList[' + skuIndex + '].costPrice');
  2202. // 成本价
  2203. var organizeCostPrice = el.find('input[name$="organizeCostPrice"]');
  2204. organizeCostPrice.val(product.organizeCostPrice)
  2205. organizeCostPrice.attr('name', 'skuList[' + skuIndex + '].organizeCostPrice');
  2206. // 成本价
  2207. var cmCostPrice = el.find('input[name$="cmCostPrice"]');
  2208. cmCostPrice.val(product.cmCostPrice)
  2209. cmCostPrice.attr('name', 'skuList[' + skuIndex + '].cmCostPrice');
  2210. // 比例成本百分比
  2211. var shopPercent = el.find('input[name$="shopPercent"]');
  2212. shopPercent.val(product.shopPercent)
  2213. shopPercent.attr('name', 'skuList[' + skuIndex + '].shopPercent');
  2214. // 组织百分比
  2215. var organizePercent = el.find('input[name$="organizePercent"]');
  2216. organizePercent.val(product.organizePercent)
  2217. organizePercent.attr('name', 'skuList[' + skuIndex + '].organizePercent');
  2218. // 采美百分比
  2219. var cmPercent = el.find('input[name$="cmPercent"]');
  2220. cmPercent.val(product.cmPercent)
  2221. cmPercent.attr('name', 'skuList[' + skuIndex + '].cmPercent');
  2222. if (product.costCheckFlag != 1) {
  2223. shopPercent.parent('.sku-shopPercent').show();
  2224. costPrice.parent('.sku-costPrice').hide();
  2225. } else {
  2226. costPrice.parent('.sku-costPrice').show();
  2227. shopPercent.parent('.sku-shopPercent').hide();
  2228. }
  2229. // 机构价
  2230. var price = el.find('input[name$="price"]');
  2231. price.val(product.price)
  2232. price.attr('name', 'skuList[' + skuIndex + '].price');
  2233. // 商品展示阶梯价格
  2234. var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
  2235. // 起订量
  2236. var ladderPriceBox = el.find('.ladderPriceBox');
  2237. ladderPriceFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceFlag');
  2238. ladderPriceFlag.eq(0).attr('checked', product.ladderPriceFlag != 1);
  2239. ladderPriceFlag.eq(1).attr('checked', product.ladderPriceFlag == 1);
  2240. // 起订量
  2241. var minBuyNumber = el.find('input[name$="minBuyNumber"]');
  2242. minBuyNumber.val(product.minBuyNumber)
  2243. minBuyNumber.attr('name', 'skuList[' + skuIndex + '].minBuyNumber');
  2244. if (product.ladderPriceFlag == 1) {
  2245. ladderPriceBox.show();
  2246. minBuyNumber.parent('.sku-minBuyNumber').hide();
  2247. }
  2248. // if (organize != 0) {
  2249. // ladderPriceFlag.parent().parent().hide();
  2250. // }
  2251. costCheckFlag.parent().parent().hide();
  2252. ladderPriceBox.find('.ladderPrice').each(function (index, item) {
  2253. var ladderPrice = {}
  2254. if (product.ladderPriceList && product.ladderPriceList.length > 0) {
  2255. ladderPrice = product.ladderPriceList[index] || {};
  2256. }
  2257. console.log('ladderPrice---', ladderPrice)
  2258. // 起订量
  2259. var buyNum = $(item).find('[name$="buyNum"]');
  2260. buyNum.val(ladderPrice.buyNum);
  2261. buyNum.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyNum');
  2262. console.log('buyNum---', ladderPrice.buyNum)
  2263. if(ladderPrice.buyNum!=null){
  2264. $(this).show()
  2265. }
  2266. // 价格
  2267. var buyPrice = $(item).find('[name$="buyPrice"]');
  2268. buyPrice.val(ladderPrice.buyPrice);
  2269. buyPrice.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyPrice');
  2270. // 阶梯价id
  2271. var id = $(item).find('[name$="id"]');
  2272. id.val(ladderPrice.id);
  2273. id.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].id');
  2274. // 阶梯价delFlag
  2275. var delFlag = $(item).find('[name$="delFlag"]');
  2276. delFlag.val(ladderPrice.delFlag || 1);
  2277. delFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].delFlag');
  2278. });
  2279. skuIndex++;
  2280. }
  2281. function skuEventBind(el, product) {
  2282. var i = product.skuIndex;
  2283. // 商品展示阶梯价格
  2284. var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
  2285. // 起订量
  2286. var ladderPriceBox = el.find('.ladderPriceBox');
  2287. var minBuyNumber = el.find('input[name$="minBuyNumber"]');
  2288. // 成本价 or 百分比
  2289. var costCheckFlag = el.find('input[name$="costCheckFlag"]');
  2290. var costPrice = el.find('input[name$="costPrice"]');
  2291. var shopPercent = el.find('input[name$="shopPercent"]');
  2292. var organizePercent = el.find('input[name$="organizePercent"]');
  2293. var cmPercent = el.find('input[name$="cmPercent"]');
  2294. // 机构价
  2295. var clubPrice = el.find('input[name$="skuList[' + i + '].price"]');
  2296. //阶梯价格
  2297. var ladderPrice = el.find('input[name$="skuList[' + i + '].ladderPriceList[0].buyPrice"]');
  2298. var ladderPrice2 = el.find('input[name$="skuList[' + i + '].ladderPriceList[1].buyPrice"]');
  2299. var ladderPrice3 = el.find('input[name$="skuList[' + i + '].ladderPriceList[2].buyPrice"]');
  2300. //起订量
  2301. var num = el.find('input[name$="skuList[' + i + '].ladderPriceList[0].buyNum"]');
  2302. var num2 = el.find('input[name$="skuList[' + i + '].ladderPriceList[1].buyNum"]');
  2303. var num3 = el.find('input[name$="skuList[' + i + '].ladderPriceList[2].buyNum"]');
  2304. num2.on('change', function () {
  2305. var buyNum = num.val() * 1;
  2306. var buyNum2 = num2.val() * 1;
  2307. if (buyNum2 <= buyNum) {
  2308. alertx('请输入大于上一阶起订量的值');
  2309. num2.val('');
  2310. }
  2311. })
  2312. num3.on('change', function () {
  2313. var buyNum2 = num2.val() * 1;
  2314. var buyNum3 = num3.val() * 1;
  2315. if (buyNum3 <= buyNum2) {
  2316. alertx('请输入大于上一阶起订量的值');
  2317. num3.val('');
  2318. }
  2319. })
  2320. ladderPrice.on('change', function () {
  2321. var ldp = ladderPrice.val() * 1;
  2322. var price = clubPrice.val() * 1;
  2323. if (ldp > price) {
  2324. alertx('第一个阶梯价格不能大于机构价');
  2325. ladderPrice.val('');
  2326. }
  2327. })
  2328. ladderPrice2.on('change', function () {
  2329. var ldp2 = ladderPrice2.val() * 1;
  2330. var ldp = ladderPrice.val() * 1;
  2331. if (ldp2 >= ldp) {
  2332. alertx('第二个阶梯价格不能大于第一个阶梯价格');
  2333. ladderPrice2.val('');
  2334. }
  2335. })
  2336. ladderPrice3.on('change', function () {
  2337. var ldp2 = ladderPrice2.val() * 1;
  2338. var ldp3 = ladderPrice3.val() * 1;
  2339. if (ldp3 >= ldp2) {
  2340. alertx('第三个阶梯价格不能大于第二个阶梯价格');
  2341. ladderPrice3.val('');
  2342. }
  2343. })
  2344. ladderPriceFlag.on('change', function () {
  2345. if (product && product.svipFlag == 1 && $(this).val() == 1) {
  2346. alert("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
  2347. ladderPriceFlag.eq(0).attr('checked', true);
  2348. ladderPriceFlag.eq(1).attr('checked', false);
  2349. ladderPriceFlag.eq(1).attr('disabled', true);
  2350. return;
  2351. }
  2352. if ($(this).val() == 1) {
  2353. ladderPriceBox.show();
  2354. minBuyNumber.parent('.sku-minBuyNumber').hide();
  2355. el.find('input[name$="skuList[' + i + '].ladderPriceList[0].delFlag"]').val(0);
  2356. } else {
  2357. ladderPriceBox.hide();
  2358. minBuyNumber.parent('.sku-minBuyNumber').show();
  2359. }
  2360. })
  2361. ladderPriceBox.find('.addBtn').on('click', function () {
  2362. $(this).hide();
  2363. $(this).parent('.ladderPrice').find('.delBtn').hide();
  2364. $(this).parent('.ladderPrice').next().show();
  2365. $(this).parent('.ladderPrice').next().find('.delBtn').show();
  2366. $(this).parent('.ladderPrice').next().find('.delFlag').val(0);
  2367. })
  2368. ladderPriceBox.find('.delBtn').on('click', function () {
  2369. $(this).hide();
  2370. $(this).parent('.ladderPrice').hide();
  2371. $(this).parent('.ladderPrice').find('.delFlag').val(1);
  2372. $(this).parent('.ladderPrice').prev().find('.addBtn').show();
  2373. $(this).parent('.ladderPrice').prev().find('.delBtn').show();
  2374. })
  2375. if(product.ladderPriceFlag == 1){
  2376. ladderPriceBox.find('.ladderPrice').each(function (index, item) {
  2377. var ladderPrice = product.ladderPriceList[index]
  2378. var delFlag = 1
  2379. if (ladderPrice) {
  2380. delFlag = ladderPrice.delFlag
  2381. }
  2382. console.log(delFlag)
  2383. if (index != 0) {
  2384. $(item).hide();
  2385. }
  2386. if (delFlag == 0 && product.ladderPriceFlag == 1) {
  2387. $(item).show()
  2388. }
  2389. })
  2390. }
  2391. costCheckFlag.on('change', function () {
  2392. if ($(this).val() == 1) {
  2393. shopPercent.parent('.sku-shopPercent').hide();
  2394. costPrice.parent('.sku-costPrice').show();
  2395. } else {
  2396. shopPercent.parent('.sku-shopPercent').show();
  2397. costPrice.parent('.sku-costPrice').hide();
  2398. }
  2399. })
  2400. }
  2401. // 添加相关参数
  2402. var productParametersIndex = $('#productParametersLength').val() - 1;
  2403. $(".addParams").click(function () {
  2404. var val = $("#paramsName").val();
  2405. // alertx("+++++"+val.length)
  2406. productParametersIndex++;
  2407. var html = '<div id="paramsItem" class="paramsItem">';
  2408. html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsName" id="paramsName" style="width:142px" maxlength="10" placeholder="参数名称" type="text" class="input-small"/>&nbsp;';
  2409. html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsContent" id="paramsContent" style="width:680px" maxlength="50" placeholder="请输入参数信息" type="text" class="input-small"/>&nbsp;';
  2410. html += '<span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)"">删除</span>';
  2411. html += '</div>';
  2412. $("#addParamsItems").append(html).show();
  2413. var paramsItemLength = $('.paramsItem').length;
  2414. if (paramsItemLength === 50) {
  2415. $(this).hide();
  2416. return
  2417. }
  2418. });
  2419. //添加标签
  2420. $(".addTags").click(function () {
  2421. // 获取输入新标签
  2422. var val = $("#inputTags").val();
  2423. // 清空输入框输入
  2424. $("#inputTags").val("");
  2425. if (null === val || "" === val) {
  2426. alertx("请输入商品标签");
  2427. return;
  2428. }
  2429. // 添加新标签
  2430. $("#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();
  2431. var tagsLength = $('.tags-li').length;
  2432. if (tagsLength === 6) {
  2433. $(this).hide();
  2434. return
  2435. }
  2436. });
  2437. /**
  2438. * 删除对于标签
  2439. */
  2440. function removerX(ithis) {
  2441. $(ithis).parent().remove();
  2442. var tagsLength = $('.tags-li').length;
  2443. if (tagsLength < 6) {
  2444. $('.addTags').show();
  2445. }
  2446. }
  2447. //初始化商品类型
  2448. $(function () {
  2449. changeMachine();
  2450. })
  2451. function changeMachine() {
  2452. var val = $("#productType").val();
  2453. // 0其它,1妆字号,2械字号
  2454. if (val == 1 || val == 0) {
  2455. //隐藏械字号
  2456. $(".machineType").hide();
  2457. } else if (val == 2) {
  2458. // 显示械字号
  2459. $(".machineType").show();
  2460. }
  2461. }
  2462. //初始化含税信息
  2463. $(function () {
  2464. var includedTax = $("input[name='includedTax']:checked").val();
  2465. var invoiceType = $("input[name='invoiceType']:checked").val();
  2466. var taxPoint = $("#taxPoint").val();
  2467. //1含税,0不含税
  2468. if (includedTax == 1) {
  2469. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
  2470. $("#taxPointDiv").show();
  2471. $("#supplierTaxPointDiv").show();
  2472. }
  2473. if (includedTax == 0) {
  2474. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
  2475. // 选择增值税且不为不开发票
  2476. if (invoiceType == 3) {
  2477. $("#taxPointDiv").hide();
  2478. $("#supplierTaxPointDiv").hide();
  2479. } else {
  2480. $("#taxPointDiv").show();
  2481. $("#supplierTaxPointDiv").show();
  2482. }
  2483. }
  2484. if (includedTax == 2) {
  2485. $("#invoiceItem").hide();
  2486. $("#taxPointDiv").hide();
  2487. $("#supplierTaxPointDiv").hide();
  2488. }
  2489. if (includedTax == "" || includedTax == null) {
  2490. $("#invoiceItem").hide();
  2491. $("#taxPointDiv").hide();
  2492. $("#supplierTaxPointDiv").hide();
  2493. }
  2494. //发票初始化
  2495. if (includedTax == 0 && (invoiceType == 1 || invoiceType == 2)) {
  2496. $("#taxPointDiv").show();
  2497. $("#supplierTaxPointDiv").show();
  2498. }
  2499. if (includedTax == 1) {//含税
  2500. // 一个都没选中默认选中增值税
  2501. if (invoiceType != 1 && invoiceType != 2) {
  2502. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2503. }
  2504. } else if (includedTax == 0) {//不含税
  2505. // 一个都没选中默认选中增值税
  2506. if (invoiceType != 1 && invoiceType != 2 && invoiceType != 3) {
  2507. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2508. }
  2509. if (invoiceType == 1) {//增值税
  2510. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2511. if (taxPoint == null || taxPoint == "") {
  2512. $("#taxPoint").val(13);
  2513. }
  2514. } else if (invoiceType == 2) {//普通发票
  2515. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2516. if (taxPoint == null || taxPoint == "") {
  2517. $("#taxPoint").val(6);
  2518. }
  2519. }
  2520. }
  2521. });
  2522. /**
  2523. * @param obj
  2524. * jquery控制input只能输入数字
  2525. */
  2526. function onlynum(obj) {
  2527. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  2528. }
  2529. function chageIncludedTax(taxPointValue) {
  2530. //修改选择项
  2531. var includedTax = $("input[name='includedTax']:checked").val();
  2532. var invoiceType = $("input[name='invoiceType']:checked").val();
  2533. var taxPoint = taxPointValue;
  2534. //1含税,0不含税,2未知
  2535. if (includedTax == 1) {
  2536. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
  2537. $("#taxPointDiv").show();
  2538. $("#supplierTaxPointDiv").show();
  2539. }
  2540. if (includedTax == 0) {
  2541. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
  2542. // 选择增值税且不为不开发票
  2543. if (invoiceType == 3) {
  2544. $("#taxPointDiv").hide();
  2545. $("#supplierTaxPointDiv").hide();
  2546. } else {
  2547. $("#taxPointDiv").show();
  2548. $("#supplierTaxPointDiv").show();
  2549. }
  2550. }
  2551. if (includedTax == 2) {
  2552. $("#invoiceItem").hide();
  2553. $("#taxPointDiv").hide();
  2554. $("#supplierTaxPointDiv").hide();
  2555. }
  2556. if (includedTax == "" || includedTax == null) {
  2557. $("#invoiceItem").hide();
  2558. $("#taxPointDiv").hide();
  2559. $("#supplierTaxPointDiv").hide();
  2560. }
  2561. if (includedTax == 1) {//含税
  2562. // 一个都没选中默认选中增值税
  2563. if (invoiceType != 1 && invoiceType != 2) {
  2564. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2565. }
  2566. } else if (includedTax == 0) {//不含税
  2567. // 一个都没选中默认选中增值税
  2568. if (invoiceType != 1 && invoiceType != 2 && invoiceType != 3) {
  2569. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2570. }
  2571. }
  2572. invoiceType = $("input[name='invoiceType']:checked").val();
  2573. if (invoiceType == 1) {//增值税
  2574. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2575. if (taxPoint == null || taxPoint == "") {
  2576. $("#taxPoint").val(13);
  2577. $("#supplierTaxPoint").val(13);
  2578. }
  2579. } else if (invoiceType == 2) {//普通发票
  2580. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2581. if (taxPoint == null || taxPoint == "") {
  2582. $("#taxPoint").val(6);
  2583. $("#supplierTaxPoint").val(6);
  2584. }
  2585. }
  2586. }
  2587. //选择发票类型
  2588. function changeInvoiceType(taxPointValue) {
  2589. var taxPoint = taxPointValue;
  2590. var includedTax = $("input[name='includedTax']:checked").val();
  2591. //选择发票类型:1增值税票,2普通票, 3不能开票
  2592. var invoiceType = $("input[name='invoiceType']:checked").val();
  2593. //只有在选择了不含税才使用税点,不含税里面的
  2594. if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
  2595. $("#taxPointDiv").show();
  2596. $("#supplierTaxPointDiv").show();
  2597. } else {
  2598. $("#taxPointDiv").hide();
  2599. $("#supplierTaxPointDiv").hide();
  2600. }
  2601. if (invoiceType == 1) {//增值税
  2602. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2603. if (taxPoint == null || taxPoint == "") {
  2604. $("#taxPoint").val(13);
  2605. $("#supplierTaxPoint").val(13);
  2606. }
  2607. } else if (invoiceType == 2) {//普通发票
  2608. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2609. if (taxPoint == null || taxPoint == "") {
  2610. $("#taxPoint").val(6);
  2611. $("#supplierTaxPoint").val(6);
  2612. }
  2613. }
  2614. }
  2615. //删除相关参数
  2616. function deleteParams(paramsThis) {
  2617. $(paramsThis).parent().remove();
  2618. var paramsItemLength = $('.paramsItem').length;
  2619. if (paramsItemLength < 50) {
  2620. $('.addParams').show();
  2621. }
  2622. }
  2623. //限制两位小数
  2624. function setTwoNumberDecimal(that) {
  2625. var n = parseFloat(that.value);
  2626. that.value = n.toFixed(2)
  2627. }
  2628. //培训相关显示
  2629. function trainingShow() {
  2630. var commodityType = $("input[name='commodityType']:checked").val();
  2631. var trainingType = $("input[name='trainingType']:checked").val();
  2632. if (commodityType == 2) {
  2633. $(".training").show();
  2634. if (trainingType == 1) {
  2635. $("#trainingFee").show();
  2636. } else {
  2637. $("#trainingFee").hide();
  2638. }
  2639. } else {
  2640. $(".training").hide();
  2641. $("#trainingFee").hide();
  2642. }
  2643. }
  2644. </script>
  2645. </body>
  2646. </html>