productEdit.jsp 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046
  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. <style>
  10. .red {
  11. color: red;
  12. }
  13. .blue {
  14. color: rgb(0, 100, 180);
  15. }
  16. #inputForm {
  17. max-width: 1200px;
  18. width: 100%;
  19. }
  20. #inputForm table {
  21. width: 100%;
  22. line-height: 18px;
  23. margin-bottom: 50px;
  24. }
  25. #inputForm th, #inputForm td {
  26. font-weight: normal;
  27. text-align: left;
  28. padding: 8px 5px;
  29. border-bottom: 1px solid rgb(238, 238, 238);
  30. }
  31. #inputForm th {
  32. width: 15%;
  33. text-align: right;
  34. white-space: nowrap;
  35. font-weight: bold;
  36. }
  37. #inputForm td input[type="text"] {
  38. width: 320px;
  39. height: 16px;
  40. line-height: 16px;
  41. }
  42. #inputForm td input.short {
  43. width: 110px;
  44. }
  45. #inputForm td b.line {
  46. margin: 0 15px 0 20px;
  47. font-weight: normal
  48. }
  49. #allAreaInput {
  50. padding: 10px 0 0 100px;
  51. }
  52. #inputForm .item {
  53. line-height: 28px;
  54. }
  55. #ladderPriceBox {
  56. border-top: 1px solid rgb(238, 238, 238);
  57. margin-top: 8px;
  58. padding-top: 8px;
  59. }
  60. #ladderPriceBox > div {
  61. margin-bottom: 5px;
  62. }
  63. .priceIcon:before {
  64. content: '\2729';
  65. color: #aaa;
  66. font-size: 18px;
  67. font-style: normal;
  68. }
  69. .priceIcon.full:before {
  70. content: '\272E';
  71. color: #ffbd14;
  72. }
  73. #slider {
  74. width: 335px;
  75. }
  76. .skword input {
  77. margin: 2px 0;
  78. }
  79. .skword p {
  80. margin: 2px 0;
  81. }
  82. .params input {
  83. margin: 2px 0;
  84. }
  85. .tags input {
  86. margin: 2px 0;
  87. }
  88. #tagsList {
  89. margin: 2px 0;
  90. display: none;
  91. width: 600px;
  92. }
  93. .tags-li {
  94. margin: 10px;
  95. display: inline-block;
  96. padding: 5px 10px;
  97. line-height: 16px;
  98. text-align: center;
  99. position: relative;
  100. font-size: 12px;
  101. border: 1px solid #EBEBEB;
  102. border-radius: 4px;
  103. }
  104. .tags-li i {
  105. font-style: normal;
  106. line-height: 20px;
  107. display: block;
  108. position: absolute;
  109. width: 16px;
  110. height: 16px;
  111. text-align: center;
  112. background: rgba(0, 0, 0, 0.2);
  113. border-radius: 50%;
  114. top: -8px;
  115. right: -7px;
  116. cursor: pointer;
  117. }
  118. .tags-li .tags-s {
  119. background: #FFF;
  120. width: auto !important;
  121. outline: none;
  122. border: none;
  123. }
  124. .upload-content {
  125. margin-top: -70px;
  126. display: inline-block;
  127. }
  128. .conList{
  129. float: left;
  130. }
  131. .upload-content .conList .btn:nth-of-type(1) {
  132. width: 90px;
  133. height: 113px;
  134. border: 2px solid #eee;
  135. background: #fff;
  136. position: relative;
  137. }
  138. .upload-content .conList .btn:nth-of-type(1) > div {
  139. position: absolute;
  140. top: 50%;
  141. left: 50%;
  142. transform: translate(-50%, -50%);
  143. color: #666;
  144. }
  145. .upload-content .conList .btn:nth-of-type(1) span {
  146. font-size: 35px;
  147. }
  148. .upload-content .conList .btn:nth-of-type(1) h5 {
  149. color: #666;
  150. }
  151. .cancel-upload {
  152. background: transparent;
  153. border: none;
  154. box-shadow: none;
  155. position: relative;
  156. top: -53px;
  157. left: -25px;
  158. cursor: pointer;
  159. z-index: 100;
  160. }
  161. .upload-content .conList ol{
  162. list-style-type: none;
  163. }
  164. .upload-content .conList ol li {
  165. width: 114px;
  166. height: 114px;
  167. text-align: center;
  168. background: #fff;
  169. position: relative;
  170. top: 130px;
  171. margin-left: 2px;
  172. left: -25px;
  173. overflow: hidden;
  174. }
  175. .upload-content-image {
  176. margin-top: -70px;
  177. }
  178. .upload-content-image .conList .btn:nth-of-type(1) {
  179. width: 90px;
  180. height: 100px;
  181. border: 2px solid #eee;
  182. background: #fff;
  183. position: relative;
  184. }
  185. .upload-content-image .conList .btn:nth-of-type(1) > div {
  186. position: absolute;
  187. top: 50%;
  188. left: 50%;
  189. transform: translate(-50%, -50%);
  190. color: #666;
  191. }
  192. .upload-content-image .conList .btn:nth-of-type(1) span {
  193. font-size: 35px;
  194. }
  195. .upload-content-image .conList .btn:nth-of-type(1) h5 {
  196. color: #666;
  197. }
  198. .upload-content-image .conList ol li {
  199. width: 114px;
  200. min-height: 80px;
  201. text-align: center;
  202. background: #fff;
  203. position: relative;
  204. top: 136px;
  205. margin-left: 2px;
  206. left: -25px;
  207. }
  208. .cancel-upload-image {
  209. background: transparent;
  210. border: none;
  211. box-shadow: none;
  212. position: relative;
  213. top: -38px;
  214. left: -25px;
  215. cursor: pointer;
  216. z-index: 100;
  217. }
  218. .hide-pic {
  219. display: none !important;
  220. }
  221. .hide-pic-image {
  222. display: none !important;
  223. }
  224. .form-horizontal .controls:first-child{
  225. padding-left: 0 !important;
  226. margin-left: 0 !important;
  227. }
  228. </style>
  229. </head>
  230. <body>
  231. <ul class="nav nav-tabs">
  232. <li><a href="${ctx}/product/new/list">商品信息列表</a></li>
  233. <c:if test="${not empty product.id}">
  234. <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">商品信息编辑</a></li>
  235. </c:if>
  236. <c:if test="${empty product.id}">
  237. <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">发布特殊供应商商品</a></li>
  238. </c:if>
  239. </ul>
  240. <form:form id="inputForm" modelAttribute="product"
  241. 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}"
  242. method="post" class="form-horizontal">
  243. <form:hidden path="id"/>
  244. <form:hidden path="searchName"/>
  245. <sys:message content="${message}"/>
  246. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  247. <tr>
  248. <th><b class="blue">商品基本信息:</b></th>
  249. <td colspan="3"></td>
  250. </tr>
  251. <tr>
  252. <th><span class="red">*</span>商品显示名:</th>
  253. <td colspan="3">
  254. <form:input path="name" maxlength="100" onchange="checkmaxlength(this.value)"
  255. class="input-small required"/>
  256. <span>
  257. <span style="font-weight: bold;">商品编码:</span>
  258. <span><form:input path="productCode" maxlength="100"/></span>
  259. </span>
  260. </td>
  261. </tr>
  262. <tr>
  263. <th><span class="red">*</span>内部商品名:</th>
  264. <td colspan="3">
  265. <form:input path="aliasName" maxlength="100" onchange="checkmaxlength(this.value)"
  266. class="input-small required"/>
  267. <span>
  268. <span style="font-weight: bold;">商品备注:</span>
  269. <span><form:input path="productRemarks" maxlength="60" onchange="checkmaxlengths(this.value,60)"
  270. class="input-small"/></span>
  271. </span>
  272. </td>
  273. </tr>
  274. <tr>
  275. <th>搜索关键字:</th>
  276. <td colspan="3" class="skword">
  277. <form:input path="searchKeyList[0]" maxlength="32" placeholder="建议输入品牌关键词"
  278. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  279. <form:input path="searchKeyList[1]" maxlength="32" placeholder="建议输入商品学名关键词"
  280. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  281. <form:input path="searchKeyList[2]" maxlength="32" placeholder="建议输入商品别名/市场称呼关键词"
  282. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  283. <form:input path="searchKeyList[3]" maxlength="32" placeholder="建议输入商品大分类关键词"
  284. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  285. <form:input path="searchKeyList[4]" maxlength="32" placeholder="建议输入商品小分类关键词"
  286. onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
  287. <p>请务必准确定义关键词,关键词会影响商品的搜索结果,建议从品牌,商品学名,商品别名,商品大类别和商品小类别5个方面考虑,每个关键词不超过16个汉字。</p>
  288. </td>
  289. </tr>
  290. <tr>
  291. <th>相关参数:</th>
  292. <td colspan="3" class="params">
  293. <div id="addParamsItems">
  294. <%--相关参数层--%>
  295. <input type="hidden" value="${fn:length(product.productParametersList)}"
  296. id="productParametersLength">
  297. <c:forEach items="${product.productParametersList}" var="item" varStatus="varIndex">
  298. <div id="paramsItem" class="paramsItem">
  299. <form:input path="productParametersList[${varIndex.index}].paramsName" id="paramsName"
  300. cssStyle="width:142px" maxlength="10" placeholder="参数名称" class="input-small"/>
  301. <form:input path="productParametersList[${varIndex.index}].paramsContent" id="paramsContent"
  302. cssStyle="width:680px" maxlength="50" placeholder="请输入参数信息"
  303. class="input-small"/>
  304. <span type="button" style="cursor: pointer;color: #0B61A4"
  305. onclick="deleteParams(this)">删除</span>
  306. </div>
  307. </c:forEach>
  308. </div>
  309. <button class="addParams" onclick="return false">添加参数</button>
  310. </td>
  311. </tr>
  312. <tr>
  313. <th>品牌:</th>
  314. <td colspan="3">
  315. <form:select path="brandID" class="input-small">
  316. <form:option value="" label="请选择"/>
  317. <form:options items="${brandList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
  318. </form:select>
  319. </td>
  320. </tr>
  321. <c:if test="${product.shopType == 2}">
  322. <tr>
  323. <th><span style="color: red">*</span>供应商:</th>
  324. <td colspan="3">
  325. <form:select path="shopID" class="input-small required" onchange="getCodes(this.value)">
  326. <form:option value="" label="请选择"/>
  327. <c:forEach items="${shopList}" var="shop" varStatus="index">
  328. <form:option value="${shop.shopID}" label="${shop.name}"/>
  329. </c:forEach>
  330. </form:select>
  331. </td>
  332. </tr>
  333. <tr>
  334. <th>商品图片:</th>
  335. <td>
  336. <div class="controls upload-content" id="secondHandImage" style="width: 800px;">
  337. <div class="conList">
  338. <form:hidden value="${product.image1}" id="image1" path="image1" htmlEscape="false"
  339. maxlength="255" class="input-xlarge required"/>
  340. <sys:ckfinder input="image1" type="images" uploadPath="/photo" selectMultiple="false"
  341. maxWidth="100"
  342. maxHeight="100"/>
  343. </div>
  344. <div class="conList hide-pic">
  345. <form:hidden value="${product.image2}" id="image2" path="image2" htmlEscape="false"
  346. maxlength="255" class="input-xlarge"/>
  347. <sys:ckfinder input="image2" type="images" uploadPath="/photo" selectMultiple="false"
  348. maxWidth="100"
  349. maxHeight="100"/>
  350. </div>
  351. <div class="conList hide-pic">
  352. <form:hidden value="${product.image3}" id="image3" path="image3" htmlEscape="false"
  353. maxlength="255" class="input-xlarge"/>
  354. <sys:ckfinder input="image3" type="images" uploadPath="/photo" selectMultiple="false"
  355. maxWidth="100"
  356. maxHeight="100"/>
  357. </div>
  358. <div class="conList hide-pic">
  359. <form:hidden value="${product.image4}" id="image4" path="image4" htmlEscape="false"
  360. maxlength="255" class="input-xlarge"/>
  361. <sys:ckfinder input="image4" type="images" uploadPath="/photo" selectMultiple="false"
  362. maxWidth="100"
  363. maxHeight="100"/>
  364. </div>
  365. <div class="conList hide-pic">
  366. <form:hidden value="${product.image5}" id="image5" path="image5" htmlEscape="false"
  367. maxlength="255" class="input-xlarge"/>
  368. <sys:ckfinder input="image5" type="images" uploadPath="/photo" selectMultiple="false"
  369. maxWidth="100"
  370. maxHeight="100"/>
  371. </div>
  372. </div>
  373. <div class="conList upload-tips" style="margin-top: 20px;">
  374. <font color="red">第一张图作为商品主图必传;最多上传5张商品图片,请尽量全部上传,单张图片不能超过5M</font>
  375. </div>
  376. </td>
  377. </tr>
  378. </c:if>
  379. <tr>
  380. <th>组合名称:</th>
  381. <td colspan="3">
  382. <form:select path="combinationID" class="input-small">
  383. <form:option value="" label="请选择"/>
  384. <form:options items="${combinationList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
  385. </form:select>
  386. </td>
  387. </tr>
  388. <tr>
  389. <th><span class="red">*</span>商品标签:</th>
  390. <td colspan="3">
  391. <input id="inputTags" maxlength="15" style="width:217px;border-radius:5px" placeholder="请输入商品标签"
  392. class="input-small"/>
  393. <button class="addTags" onclick="return false">添加标签</button>
  394. <p style="margin-top: 5px">简述商品功效和特性,最多可添加6个标签,每个标签字数不超过15个汉字(如:美白祛斑,消除皱纹)</p>
  395. <div id="tagsList">
  396. <input type="hidden" name="tagsLists" value="${product.tags}" id="tagsLists">
  397. <%--标签--%>
  398. </div>
  399. </td>
  400. </tr>
  401. <tr>
  402. <th><span class="red">*</span>商品属性:</th>
  403. <td colspan="3">
  404. <label><input type="radio" name="commodityType" value="1"
  405. onchange="loadBigType()" ${product.commodityType == "1" ? "checked" : ""} />产品<b
  406. class="line">|</b></label>
  407. <label><input type="radio" name="commodityType" value="2"
  408. onchange="loadBigType()" ${product.commodityType == "2" ? "checked" : ""} />仪器</label>
  409. </td>
  410. </tr>
  411. <tr class="training" hidden>
  412. <th><span class="red">*</span>培训方式:</th>
  413. <td colspan="3">
  414. <label><input type="radio" name="trainingMethod"
  415. value="1" ${empty product.trainingMethod || product.trainingMethod == 1 ? "checked" : ""} />线上培训<b
  416. class="line">|</b></label>
  417. <label><input type="radio" name="trainingMethod"
  418. value="2" ${product.trainingMethod == 2 ? "checked" : ""} />线下培训</label>
  419. </td>
  420. </tr>
  421. <tr class="training" hidden>
  422. <th><span class="red">*</span>培训费用:</th>
  423. <td colspan="3">
  424. <label><input type="radio" name="trainingType"
  425. value="1" ${empty product.trainingType || product.trainingType == 1 ? "checked" : ""}
  426. onchange="trainingShow()"/>售价未包含<b class="line">|</b></label>
  427. <label><input type="radio" name="trainingType" value="2" ${product.trainingType == 2 ? "checked" : ""}
  428. onchange="trainingShow()"/>售价已包含</label>
  429. </td>
  430. </tr>
  431. <tr id="trainingFee" hidden>
  432. <th></th>
  433. <td colspan="3">
  434. <input type="number" name="trainingFee" value="${product.trainingFee}" style="width: 250px" min="0"
  435. placeholder="请填写包含食宿,交通等各项费用的总金额"/>
  436. </td>
  437. </tr>
  438. <tr>
  439. <th><span class="red">*</span>分类:</th>
  440. <td colspan="3">
  441. <form:select path="bigTypeID" class="input-small required" id="bigType" onchange="loadSmallType()">
  442. <form:option value="" label="请选择"/>
  443. <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
  444. htmlEscape="false"/>
  445. </form:select>
  446. <form:select path="smallTypeID" class="input-small" id="smallType" onchange="loadTinyType()">
  447. <form:option value="" label="请选择"/>
  448. <c:forEach items="${classify.smalltypeList}" var="smallType">
  449. <form:option value="${smallType.smallTypeID}" label="${smallType.name}"
  450. bigTypeID="${smallType.bigTypeID}"/>
  451. </c:forEach>
  452. </form:select>
  453. <form:select path="tinyTypeID" class="input-small" id="tinyType">
  454. <form:option value="" label="请选择"/>
  455. <c:forEach items="${classify.tinytypeList}" var="tinyType">
  456. <form:option value="${tinyType.tinyTypeID}" label="${tinyType.name}"
  457. bigTypeID="${tinyType.smallTypeID}"/>
  458. </c:forEach>
  459. </form:select>
  460. </td>
  461. </tr>
  462. <tr>
  463. <th><span class="red">*</span>商品类型:</th>
  464. <td colspan="3">
  465. <form:select path="productType" id="productType" onchange="js()" class="input-small required" onclick="changeMachine(this)">
  466. <form:option value="" label="请选择"/>
  467. <form:option value="1" label="妆字号"/>
  468. <form:option value="2" label="械字号"/>
  469. <form:option value="0" label="其它"/>
  470. </form:select>
  471. <span class="machineType">
  472. <form:select path="machineType" id="machineType" onchange="js()" class="input-small">
  473. <form:option value="" label="请选择"/>
  474. <form:option value="1" label="一类"/>
  475. <form:option value="2" label="二类"/>
  476. <form:option value="3" label="三类"/>
  477. </form:select>
  478. </span>
  479. </td>
  480. </tr>
  481. <tr id="xiezihao" class="machineType">
  482. <th><span class="red">*</span>资质证书:</th>
  483. <td colspan="3">
  484. <%-- 械字号医疗证书--%>
  485. <form:hidden id="qualificationImg" path="qualificationImg" htmlEscape="false" maxlength="255"
  486. class="input-xlarge"/>
  487. <sys:ckfinder input="qualificationImg" type="images" uploadPath="/photo" selectMultiple="false"
  488. maxWidth="100" maxHeight="100"/>
  489. </td>
  490. </tr>
  491. <tr class="machineType">
  492. <th><span class="red">*</span>证书编号:</th>
  493. <td colspan="1">
  494. <form:input path="qualificationNo" maxlength="50" class="input-small"/>
  495. </td>
  496. </tr>
  497. <tr class="machineType">
  498. <th><span class="red">*</span>产品名称:</th>
  499. <td colspan="2">
  500. <form:input path="productName" maxlength="80" class="input-small"/>
  501. </td>
  502. </tr>
  503. <tr class="machineType">
  504. <th><span class="red">*</span>证书有效期:</th>
  505. <td colspan="3">
  506. <%-- <form:input path="qualificationTime" type="text" maxlength="20" class="input-medium Wdate" value="${product.qualificationTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>--%>
  507. <form:input path="qualificationTime" type="text" maxlength="10" class="input-medium Wdate"
  508. value="${qualificationTime}"
  509. onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
  510. </td>
  511. </tr>
  512. <tr class="machineType">
  513. <th><span class="red">*</span>证书基本信息链接:</th>
  514. <td colspan="4">
  515. <form:input path="qualificationLink" maxlength="300"
  516. class="input-small"/>
  517. </td>
  518. </tr>
  519. <tr>
  520. <th><span class="red">*</span>市场价:</th>
  521. <td colspan="3"><form:input path="normalPrice" type="number" maxlength="11"
  522. class="short input-small required"/>元
  523. </td>
  524. </tr>
  525. <tr>
  526. <th><span class="red">*</span>商品展示价格:</th>
  527. <td colspan="3">
  528. <label><input type="radio" name="ladderPriceFlag" value="0"
  529. onchange="changeLadderPrice()" ${product.ladderPriceFlag == "0" ? "checked" : ""} />不使用阶梯价格<b
  530. class="line">|</b></label>
  531. <label><input type="radio" name="ladderPriceFlag" value="1"
  532. onchange="changeLadderPrice()" ${product.ladderPriceFlag == "1" ? "checked" : ""} />使用阶梯价格</label>
  533. </td>
  534. </tr>
  535. <tr>
  536. <th style="vertical-align:top;padding-top:15px;"><span class="red">*</span>机构价:</th>
  537. <td colspan="3">
  538. <div class="item">
  539. <div id="normalPriceBox">
  540. <form:input path="price" type="number" id="price" maxlength="11"
  541. class="short computedPrice required" onkeyup="computedPriceLevel(this.value)"/>
  542. <b class="line">|</b>游客展示等级:<span>
  543. <i class="priceIcon"></i>
  544. <i class="priceIcon"></i>
  545. <i class="priceIcon"></i>
  546. <i class="priceIcon"></i>
  547. <i class="priceIcon"></i>
  548. </span>
  549. </div>
  550. <div id="ladderPriceBox">
  551. <div id="ladderPrice1">
  552. 起订量:<form:input path="ladderPriceList[0].buyNum" min="1" type="number" maxlength="11"
  553. class="short number" onblur="checkBuyNum(this, 0)"/>(${product.unit})及以上,
  554. <form:input path="ladderPriceList[0].buyPrice" type="number" maxlength="11"
  555. class="short price" onblur="checkBuyPrice(this, 0)"/>元/(${product.unit})
  556. <span class="showBtn ${null != product.ladderPriceList[1] && null != product.ladderPriceList[1].buyNum ? "hide" : ""}">
  557. <a class="addBtn" href="javascript:;">添加</a>
  558. <form:hidden path="ladderPriceList[0].id"/>
  559. <form:hidden path="ladderPriceList[0].delFlag" id="delFlag1"/>
  560. </span>
  561. </div>
  562. <div id="ladderPrice2" ${null == product.ladderPriceList[1] && null == product.ladderPriceList[1].buyNum ? "class='hide'" : ""}>
  563. 起订量:<form:input path="ladderPriceList[1].buyNum" type="number" maxlength="11"
  564. class="short number" onblur="checkBuyNum(this, 1)"/>(${product.unit})及以上,
  565. <form:input path="ladderPriceList[1].buyPrice" type="number" maxlength="11"
  566. class="short price" onblur="checkBuyPrice(this, 1)"/>元/(${product.unit})
  567. <span class="showBtn ${null != product.ladderPriceList[2] && null != product.ladderPriceList[2].buyNum ? "hide" : ""}">
  568. <a class="delBtn" href="javascript:;">删除</a> / <a class="addBtn"
  569. href="javascript:;">添加</a>
  570. <form:hidden path="ladderPriceList[1].id"/>
  571. <form:hidden path="ladderPriceList[1].delFlag" id="delFlag2"/>
  572. </span>
  573. </div>
  574. <div id="ladderPrice3" ${null == product.ladderPriceList[2] && null == product.ladderPriceList[2].buyNum ? "class='hide'" : ""}>
  575. 起订量:<form:input path="ladderPriceList[2].buyNum" type="number" maxlength="11"
  576. class="short number" onblur="checkBuyNum(this, 2)"/>(${product.unit})及以上,
  577. <form:input path="ladderPriceList[2].buyPrice" type="number" maxlength="11"
  578. class="short price" onblur="checkBuyPrice(this, 2)"/>元/(${product.unit})
  579. <span class="showBtn"><a class="delBtn" href="javascript:;">删除</a></span>
  580. <form:hidden path="ladderPriceList[2].id"/>
  581. <form:hidden path="ladderPriceList[2].delFlag" id="delFlag3"/>
  582. </div>
  583. </div>
  584. </div>
  585. </td>
  586. </tr>
  587. <tr>
  588. <th><span class="red">*</span>是否含税:</th>
  589. <td>
  590. <label><input type="radio" name="includedTax" value="1"
  591. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "1" ? "checked" : ""}>含税<b
  592. class="line">|</b></label>
  593. <label><input type="radio" name="includedTax" value="0"
  594. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "0" ? "checked" : ""}>不含税<b
  595. class="line">|</b></label>
  596. <label><input type="radio" name="includedTax" value="2"
  597. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "2"||product.includedTax==null ? "checked" : ""}>未知</label>
  598. </td>
  599. </tr>
  600. <tr id="invoiceItem">
  601. <th></th>
  602. <td>
  603. <span class="invoice">
  604. <label><input type="radio" name="invoiceType" value="1"
  605. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "1" ? "checked" : ""}>开增值税专用发票<b
  606. class="line">|</b></label>
  607. <label><input type="radio" name="invoiceType" value="2"
  608. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "2" ? "checked" : ""}>开增值税普通发票</label>
  609. </span>
  610. <span class="notInvoice">
  611. <b class="line">|</b>
  612. <label><input type="radio" name="invoiceType" value="3"
  613. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "3"||product.invoiceType ==null ? "checked" : ""}>不能开票</label>
  614. </span>
  615. </td>
  616. </tr>
  617. <tr>
  618. <th>线上分账账号:</th>
  619. <td colspan="3">
  620. <c:if test="${not empty product.productID}">
  621. <form:select path="splitCode" class="select-ele input-medium">
  622. <form:option value="" label="请选择"/>
  623. <c:forEach items="${splitCodeList}" var="splitCodeList" varStatus="index">
  624. <form:option value="${splitCodeList.splitCode}" label="${splitCodeList.codeRemark}"/>
  625. </c:forEach>
  626. </form:select>
  627. </c:if>
  628. <c:if test="${empty product.productID}">
  629. <form:select path="splitCode" class="select-ele input-medium" id="getCode">
  630. <form:option value="" label="请选择"/>
  631. </form:select>
  632. </c:if>
  633. </td>
  634. </tr>
  635. <tr id="taxPointDiv">
  636. <th><span class="red">*</span>机构税率:</th>
  637. <td>
  638. <span><form:input path="taxPoint" maxlength="5" cssStyle="width: 35PX" class="number"
  639. onchange="setTwoNumberDecimal(this)"/>%</span>
  640. </td>
  641. </tr>
  642. <tr id="supplierTaxPointDiv">
  643. <th><span class="red">*</span>供应商税率:</th>
  644. <td>
  645. <span><form:input path="supplierTaxPoint" maxlength="5" cssStyle="width: 35PX" class="number"
  646. onchange="setTwoNumberDecimal(this)"/>%</span>
  647. </td>
  648. </tr>
  649. <tr id="priceMinNumber">
  650. <th><span class="red">*</span>起订量:</th>
  651. <td colspan="3"><form:input path="minBuyNumber" maxlength="11" class="short"/></td>
  652. </tr>
  653. <tr>
  654. <th><span class="red">*</span>商品可见度:</th>
  655. <td colspan="3">
  656. <form:select path="visibility" class="input-large required">
  657. <form:option value="3" label="所有人可见"/>
  658. <form:option value="2" label="所有机构可见"/>
  659. <form:option value="1" label="仅会员机构可见"/>
  660. <form:option value="4" label="仅医美机构可见"/>
  661. </form:select>
  662. </td>
  663. </tr>
  664. <tr>
  665. <th><span class="red">*</span>价格可见度:</th>
  666. <td colspan="3">
  667. <form:select path="priceFlag" class="input-large required">
  668. <form:option value="0" label="对所有机构公开"/>
  669. <form:option value="2" label="仅对会员机构公开"/>
  670. <form:option value="3" label="仅对医美机构公开"/>
  671. <form:option value="1" 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="commodityDetailsFlag" class="input-large required">
  679. <form:option value="1" label="所有人可见"/>
  680. <form:option value="2" label="所有机构可见"/>
  681. <form:option value="3" label="仅会员机构可见"/>
  682. <form:option value="4" label="仅医美机构可见"/>
  683. </form:select>
  684. </td>
  685. </tr>
  686. <tr>
  687. <th><span class="red">*</span>成本:</th>
  688. <td colspan="3">
  689. <label><input type="radio" name="costCheckFlag" value="1"
  690. onchange="changeCostPriceShow()" ${product.costCheckFlag == "1" ? "checked" : ""} />固定成本<b
  691. class="line">|</b></label>
  692. <label><input type="radio" name="costCheckFlag" value="2"
  693. onchange="changeCostPriceShow()" ${product.costCheckFlag == "1" ? "" : "checked"} />比例成本</label>
  694. </td>
  695. </tr>
  696. <tr id="costPriceShow">
  697. <th><span class="red">*</span><b class="costFlagText">成本价</b>:</th>
  698. <td colspan="3"><form:input path="costPrice" id="costPrice" type="number" maxlength="11" class="short"/> 元
  699. </td>
  700. </tr>
  701. <tr id="costPropShow">
  702. <th><span class="red">*</span>比例成本百分比:</th>
  703. <td colspan="3"><form:input path="costProportional" id="costProportional" type="number" maxlength="11"
  704. class="short"/> %
  705. </td>
  706. </tr>
  707. <tr>
  708. <th>库存:</th>
  709. <td colspan="3"><form:input path="stock" type="number" maxlength="11" class="short"/></td>
  710. </tr>
  711. <tr>
  712. <th><span class="red">*</span>购买数量:</th>
  713. <td colspan="3">
  714. <label><input type="radio" name="step" value="1" ${product.step == "1" ? "checked" : ""}>逐步增长<b
  715. class="line">|</b></label>
  716. <label><input type="radio" name="step" value="2" ${product.step == "2" ? "checked" : ""}>以起订量增长</label>
  717. </td>
  718. </tr>
  719. <tr>
  720. <th><span class="red">*</span>运费:</th>
  721. <%--<td colspan="3">
  722. <label><input type="radio" name="byFlag" value="0" ${product.byFlag == "0" ? "checked" : ""}>买家承担<b class="line">|</b></label>
  723. <label><input type="radio" name="byFlag" value="1" ${product.byFlag == "1" ? "checked" : ""}>卖家承担</label>
  724. </td>--%>
  725. <td colspan="3">
  726. <label><input type="radio" name="freePostFlag"
  727. value="2" ${(empty product.freePostFlag || product.freePostFlag eq "2") ? "checked" : ""}>默认(遵循运费规则)<b
  728. class="line">|</b></label>
  729. <label><input type="radio" name="freePostFlag"
  730. value="0" ${product.freePostFlag == "0" ? "checked" : ""}>包邮<b class="line">|</b></label>
  731. <label><input type="radio" name="freePostFlag"
  732. value="1" ${product.freePostFlag == "1" ? "checked" : ""}>到付</label>
  733. </td>
  734. </tr>
  735. <tr>
  736. <th><span class="red">*</span>包装规格:</th>
  737. <td><form:input path="unit" maxlength="20" class="short required"/></td>
  738. </tr>
  739. <tr>
  740. <th><span class="red">*</span>销售区域:</th>
  741. <td colspan="3">
  742. <label><input type="radio" name="allAreaFlag" value="1"
  743. onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "checked" : ""}>全部区域<b
  744. class="line">|</b></label>
  745. <label><input type="radio" name="allAreaFlag" value="0"
  746. onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "" : "checked"}>指定区域</label>
  747. </td>
  748. </tr>
  749. <tr>
  750. <th><span class="red">*</span>首页新品展示:</th>
  751. <td colspan="3">
  752. <c:if test="${product.newProductType==1}">
  753. <input type="radio" checked="checked" name="newProductType" value="1" class="required" />参与新品展示
  754. <input type="radio" name="newProductType" value="2" class="required" />不参与新品展示
  755. </c:if>
  756. <c:if test="${empty product.newProductType || product.newProductType==2}">
  757. <input type="radio" name="newProductType" value="1" class="required" />参与新品展示
  758. <input type="radio" checked="checked" name="newProductType" value="2" class="required" />不参与新品展示
  759. </c:if>
  760. </td>
  761. <%-- <td colspan="3">--%>
  762. <%-- <label><input type="radio" name="newProductType" value="1"--%>
  763. <%-- ${product.newProductType == "1" ? "checked" : ""}>参与新品展示<b--%>
  764. <%-- class="line">|</b></label>--%>
  765. <%-- <label><input type="radio" name="newProductType" value="2"--%>
  766. <%-- ${product.newProductType == "2" ? "" : "checked"}>不参与新品展示</label>--%>
  767. <%-- </td>--%>
  768. </tr>
  769. <tr>
  770. <th>商品说明:</th>
  771. <td colspan="3">
  772. <form:textarea path="productDescribe" id="wipeRemarks" maxlength="200" placeholder="请输入备注文字,不能超过200字" class="input-xlarge" rows="4"></form:textarea>
  773. <p style="width:500px;text-align:left;"><span id="remarkLen" style="color:red;">0</span>/200</p>
  774. </td>
  775. </tr>
  776. <tr id="allAreaInput">
  777. <th></th>
  778. <td>
  779. <span>
  780. <form:checkboxes path="provinceIDs" items="${provinceList}" itemLabel="name" itemValue="id"/>
  781. </span>
  782. </td>
  783. </tr>
  784. <tr>
  785. <th>订购方案:</th>
  786. <td colspan="3">
  787. <div class="detailInfoEditor" style="width: 620px;">
  788. <form:textarea path="orderInfo" class="input-xlarge hide"/>
  789. <!-- 富文本编辑器 -->
  790. <div id="orderInfoEditor">${product.orderInfo}</div>
  791. </div>
  792. </td>
  793. </tr>
  794. <tr>
  795. <th>服务详情:</th>
  796. <td colspan="3">
  797. <div class="detailInfoEditor" style="width: 620px;">
  798. <form:textarea path="serviceInfo" class="input-xlarge hide"/>
  799. <!-- 富文本编辑器 -->
  800. <div id="serviceInfoEditor">${product.serviceInfo}</div>
  801. </div>
  802. </td>
  803. </tr>
  804. <tr>
  805. <th><span class="red">*</span>资质机构商品详情:</th>
  806. <td><span style="color: red">(适用于资质机构)</span></td>
  807. <th><span class="red">*</span>普通机构商品详情:</th>
  808. <td><span style="color: red">(适用于游客和个人机构,可选择是否和资质机构商品详情相同,不相同的话需要编辑内容)</span>
  809. <label>
  810. <input type="radio"
  811. name="productDetail"
  812. value="1" ${product.productDetail == "1" ? "checked" : ""} />同资质机构商品详情<b
  813. class="line">|</b>
  814. </label>
  815. <label>
  816. <input type="radio"
  817. name="productDetail"
  818. value="2" ${product.productDetail == "2" || product.productDetail == null ? "checked" : ""} />不同于资质机构商品详情(即使用以下编辑内容)
  819. </label>
  820. </td>
  821. </tr>
  822. <tr>
  823. <td colspan="2" style="vertical-align: top;">
  824. <div class="detailInfoEditor" style="width: 620px;">
  825. <form:textarea path="detailInfo" htmlEscape="false" class="input-xlarge required hide"/>
  826. <!-- 富文本编辑器 -->
  827. <div id="detailInfoEditor">${product.detailInfo}</div>
  828. </div>
  829. </td>
  830. <td colspan="3" style="vertical-align: top;">
  831. <div class="detailInfoEditor" style="width: 620px;">
  832. <form:textarea path="commonDetailInfo" htmlEscape="false" class="input-xlarge required hide"/>
  833. <!-- 富文本编辑器 -->
  834. <div id="detailInfoEditor2">${product.commonDetailInfo==""||product.commonDetailInfo==null?"若要查看更多产品信息,请注册机构会员,如有疑问请联系客服。":product.commonDetailInfo}</div>
  835. </div>
  836. </td>
  837. </tr>
  838. <tr>
  839. <td colspan="4" style="text-align:center;">
  840. <shiro:hasPermission name="product:product:edit">
  841. <input id="btnSave" class="btn btn-primary" type="submit" value="保 存" onclick="return checkInfo()"/>
  842. </shiro:hasPermission>
  843. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  844. </td>
  845. </tr>
  846. </table>
  847. </form:form>
  848. <!-- 富文本编辑器 -->
  849. <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
  850. <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
  851. <script type="text/javascript">
  852. /*$(function () {
  853. // debugger
  854. var productType= $("#productType").val();
  855. if (productType=="2"){
  856. $("#s2id_priceFlag").val(3);
  857. $("#s2id_visibility").val(4);
  858. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  859. $("#priceFlag").prev().find(".select2-chosen").text("仅对医美机构开放");
  860. $("#priceFlag").prop("disabled",true);
  861. $("#visibility").prop("disabled",true);
  862. }
  863. });*/
  864. function js(){
  865. var val = $("#productType").val();
  866. var mac = $("#machineType").val();
  867. if(val == '2'){
  868. if (mac == '1') {
  869. // 械字号一类
  870. $("#visibility").val(3);
  871. $("#priceFlag").val(0);
  872. $("#commodityDetailsFlag").val(1);
  873. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  874. $("#priceFlag").prev().find(".select2-chosen").text("对所有机构公开");
  875. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("所有人可见");
  876. } else if (mac == '2') {
  877. // 械字号二类
  878. $("#visibility").val(3);
  879. $("#priceFlag").val(3);
  880. $("#commodityDetailsFlag").val(4);
  881. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  882. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  883. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  884. } else if(mac == '3') {
  885. // 械字号三类
  886. $("#visibility").val(3);
  887. $("#priceFlag").val(3);
  888. $("#commodityDetailsFlag").val(4);
  889. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  890. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  891. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  892. }
  893. } else {
  894. $("#priceFlag").prop("disabled",false);
  895. $("#visibility").prop("disabled",false);
  896. $("#commodityDetailsFlag").prop("disabled",false);
  897. }
  898. }
  899. $(document).ready(function () {
  900. $('body').on('keyup', '#wipeRemarks', function () {
  901. $('#remarkLen').text($(this).val().length);
  902. });
  903. //$("#name").focus();
  904. $("#inputForm").validate({
  905. ignore: "",
  906. submitHandler: function (form) {
  907. var commodityType = $("input[name='commodityType']:checked").val();
  908. if (commodityType == '' || commodityType == null) {
  909. alertx("请选择商品属性");
  910. return false;
  911. }
  912. var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  913. if (costCheckFlag * 1 === 1) {
  914. if ($("#costPrice").val() == '') {
  915. alertx("请输入成本价");
  916. return false;
  917. }
  918. ;
  919. } else {
  920. if ($("#costProportional").val() == '') {
  921. alertx("请输入成本比例");
  922. return false;
  923. }
  924. ;
  925. }
  926. if ($('#minBuyNumber:visible').length > 0) {
  927. var minBuyNumber = $('#minBuyNumber').val();
  928. if (minBuyNumber <= 0 || minBuyNumber == '') {
  929. alertx("请输入起订量");
  930. return false;
  931. }
  932. }
  933. if ($('input[name="ladderPriceList[0].buyNum"]:visible').length > 0) {
  934. var buyNum = $('input[name="ladderPriceList[0].buyNum"]').val();
  935. var buyPrice = $('input[name="ladderPriceList[0].buyPrice"]').val();
  936. if (buyNum <= 0 || buyNum == '' || buyPrice <= 0 || buyPrice == '') {
  937. alertx("请输入正确的阶梯价格");
  938. return false;
  939. }
  940. }
  941. if ($('input[name="ladderPriceList[1].buyNum"]:visible').length > 0) {
  942. var buyNum1 = $('input[name="ladderPriceList[1].buyNum"]').val();
  943. var buyPrice1 = $('input[name="ladderPriceList[1].buyPrice"]').val();
  944. if (buyNum1 <= 0 || buyNum1 == '' || buyPrice1 <= 0 || buyPrice1 == '') {
  945. alertx("请输入正确的阶梯价格");
  946. return false;
  947. }
  948. }
  949. if ($('input[name="ladderPriceList[2].buyNum"]:visible').length > 0) {
  950. var buyNum2 = $('input[name="ladderPriceList[2].buyNum"]').val();
  951. var buyPrice2 = $('input[name="ladderPriceList[2].buyPrice"]').val();
  952. if (buyNum2 <= 0 || buyNum2 == '' || buyPrice2 <= 0 || buyPrice2 == '') {
  953. alertx("请输入正确的阶梯价格");
  954. return false;
  955. }
  956. }
  957. var detailInfo = detailInfoEditor.getData();
  958. if (detailInfo == '') {
  959. alertx("请输入商品详细信息");
  960. return false;
  961. }
  962. var includedTax = $("input[name='includedTax']:checked").val();
  963. if (includedTax == '' || includedTax == null) {
  964. alertx("请选择是否含税");
  965. return false;
  966. }
  967. var invoiceType = $("input[name='invoiceType']:checked").val();
  968. if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
  969. var taxPoint = $("#taxPoint").val();
  970. var supplierTaxPoint = $("#supplierTaxPoint").val();
  971. if (taxPoint == '' || taxPoint == null) {
  972. alertx("请输入机构税率");
  973. return false;
  974. }
  975. if (supplierTaxPoint == '' || supplierTaxPoint == null) {
  976. alertx("请输入供应商税率");
  977. return false;
  978. }
  979. }
  980. if (includedTax != ${product.includedTax} || invoiceType != ${product.invoiceType}) {
  981. 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) {
  982. if (v == 'ok') {
  983. // 提交订单
  984. loading('正在提交,请稍等...');
  985. form.submit();
  986. }
  987. }, {
  988. buttonsFocus: 1, closed: function () {
  989. if (typeof closed == 'function') {
  990. closed();
  991. }
  992. }
  993. });
  994. } else {
  995. loading('正在提交,请稍等...');
  996. form.submit();
  997. }
  998. },
  999. errorContainer: "#messageBox",
  1000. errorPlacement: function (error, element) {
  1001. $("#messageBox").text("输入有误,请先更正。");
  1002. if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
  1003. error.appendTo(element.parent().parent());
  1004. } else {
  1005. error.insertAfter(element);
  1006. }
  1007. }
  1008. });
  1009. });
  1010. <%--// 商品可见度--%>
  1011. <%--/*$(function() {--%>
  1012. <%-- var initValue = ${(product.visibility <= 0) ? 3 : ((product.visibility >= 3) ? 3 : product.visibility)}--%>
  1013. <%-- var select = $("#visibility");--%>
  1014. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1015. <%-- min: 1,--%>
  1016. <%-- max: 3,--%>
  1017. <%-- range: "min",--%>
  1018. <%-- value: initValue,--%>
  1019. <%-- slide: function(event, ui) {--%>
  1020. <%-- if (ui.value*1 === 1){--%>
  1021. <%-- // 所有可见--%>
  1022. <%-- select.val(1);--%>
  1023. <%-- } else if (ui.value*1 === 2){--%>
  1024. <%-- // 会员可见--%>
  1025. <%-- select.val(2);--%>
  1026. <%-- } else{--%>
  1027. <%-- // 不可见--%>
  1028. <%-- select.val(3);--%>
  1029. <%-- }--%>
  1030. <%-- $("#visibilityNote").text(select.find("option:selected").text());--%>
  1031. <%-- }--%>
  1032. <%-- });--%>
  1033. <%--});*/--%>
  1034. <%--// 价格可见度: 1不公开价格,3仅对医美机构公开,2仅对会员机构公开,0公开价格--%>
  1035. <%--// 对应滑块:1->2->3->4--%>
  1036. <%--$(function() {--%>
  1037. <%-- var initValue = ${(product.priceFlag eq 0) ? 2 : ((product.priceFlag eq 2) ? 1 : 0)}--%>
  1038. <%-- var initValue = ${(product.priceFlag eq 1) ? 1 : ((product.priceFlag eq 3) ? 2 : ((product.priceFlag eq 2) ? 3 : 4))}--%>
  1039. <%-- var select = $("#priceFlag");--%>
  1040. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1041. <%-- min: 1,--%>
  1042. <%-- max: 4,--%>
  1043. <%-- range: "min",--%>
  1044. <%-- value: initValue,--%>
  1045. <%-- slide: function(event, ui) {--%>
  1046. <%-- if (ui.value*1 === 4){--%>
  1047. <%-- // 所有可见--%>
  1048. <%-- select.val(0);--%>
  1049. <%-- } else if (ui.value*1 === 3){--%>
  1050. <%-- // 会员可见--%>
  1051. <%-- select.val(2);--%>
  1052. <%-- } else if (ui.value*1 === 2){--%>
  1053. <%-- // 医美可见--%>
  1054. <%-- select.val(3);--%>
  1055. <%-- } else{--%>
  1056. <%-- // 不可见--%>
  1057. <%-- select.val(1);--%>
  1058. <%-- }--%>
  1059. <%-- //select[0].selectedIndex = ui.value;--%>
  1060. <%-- $("#textFlagNote").text(select.find("option:selected").text());--%>
  1061. <%-- }--%>
  1062. <%-- });--%>
  1063. <%--});--%>
  1064. function getCodes(data){
  1065. var opts = "<option value=''>请选择</option>";
  1066. $.ajax({
  1067. type: "POST",
  1068. url: "${ctx}/product/new/getCodes",
  1069. data: {"shopId": data},
  1070. success: function (res) {
  1071. console.log("data------------------->"+res)
  1072. for (let i = 0; i < res.length; i++) {
  1073. opts += "<option value='" + res[i].splitCode + "'>" + res[i].codeName + "</option>";
  1074. }
  1075. console.log(opts);
  1076. $("#getCode").html('').append(opts);
  1077. },
  1078. error: function (res) {
  1079. }
  1080. });
  1081. }
  1082. //图片初始化
  1083. if(${product.shopType == 2}){
  1084. $(function () {
  1085. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  1086. var realLength = 0;
  1087. var maxChange = "1";
  1088. for (var i = 0; i < str.length; i++) {
  1089. charCode = str.charCodeAt(i);
  1090. if (charCode >= 0 && charCode <= 128)
  1091. realLength += 1;
  1092. else {
  1093. realLength += 2;
  1094. maxChange = "2";
  1095. }
  1096. }
  1097. if (maxChange == "2") {
  1098. var s = str.substr(0, 16);
  1099. $(searckThis).val(s);
  1100. }
  1101. if (realLength > maxlength) {
  1102. alertx("关键字最多16个汉字,即32个字符!");
  1103. }
  1104. }
  1105. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1106. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  1107. $('.upload-content .conList').find('.cancel-upload').hide();
  1108. var observeEle = document.getElementsByClassName('upload-content')[0];
  1109. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  1110. var MutationObserverConfig = {
  1111. childList: true,
  1112. subtree: true,
  1113. characterData: true
  1114. };
  1115. var observer = new MutationObserver(function (mutations) {
  1116. $.each(mutations, function (index, item) {
  1117. if (item.type === 'childList') {
  1118. // 在创建新的 element 时调用
  1119. var target = $(item.target),
  1120. thisWrapper = target.closest('.conList'),
  1121. nextEle = thisWrapper.next();
  1122. thisWrapper.find('li').css('z-index', 99);
  1123. thisWrapper.find('.cancel-upload').show();
  1124. if (nextEle.hasClass('hide-pic')) {
  1125. nextEle.removeClass('hide-pic');
  1126. }
  1127. }
  1128. })
  1129. });
  1130. observer.observe(observeEle, MutationObserverConfig);
  1131. $('body').on('click', '.upload-content li', function () {
  1132. var index = $(this).closest('.conList').index() + 1,
  1133. str = 'image' + index + 'FinderOpen';
  1134. eval(str + '()');
  1135. });
  1136. $('body').on('click', '.cancel-upload', function () {
  1137. var wrapper = $(this).closest('.conList');
  1138. wrapper.find('li').css('z-index', '-1');
  1139. wrapper.find('input').val('');
  1140. $(this).hide();
  1141. if ($('.cancel-upload:visible').length < 5) {
  1142. wrapper.addClass("hide-pic");
  1143. } else {
  1144. wrapper.removeClass("hide-pic");
  1145. }
  1146. wrapper.parent().append(wrapper.clone());
  1147. wrapper.remove();
  1148. $(".conList").each(function (i, ele) {
  1149. if ($(ele).find("input.input-xlarge").val()) {
  1150. $(ele).next().removeClass("hide-pic")
  1151. }
  1152. })
  1153. });
  1154. $(window).on("load", function () {
  1155. setTimeout(function () {
  1156. $("#secondHandImage").find("input.input-xlarge").each(function (i, ele) {
  1157. if ($(ele).val()) {
  1158. $(ele).next().find("li").css("z-index", "99");
  1159. $(ele).parents(".conList").find(".cancel-upload").show();
  1160. $(ele).parents(".conList").next().removeClass("hide-pic")
  1161. }
  1162. })
  1163. }, 500);
  1164. });
  1165. $('.upload-content-image .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1166. $('.upload-content-image .conList .btn:nth-of-type(2)').after('<img class="cancel-upload-image" src="/static/images/close-btn1.png">').remove();
  1167. $('.upload-content-image .conList').find('.cancel-upload-image').hide();
  1168. var observeEleImage = document.getElementsByClassName('upload-content-image')[0];
  1169. // var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
  1170. var MutationObserverImage = window.MutationObserver || window.WebKitMutationObserver;
  1171. var MutationObserverConfigImage = {
  1172. childList: true,
  1173. subtree: true,
  1174. characterData: true
  1175. };
  1176. var observerImage = new MutationObserverImage(function (mutations) {
  1177. $.each(mutations, function (index, item) {
  1178. if (item.type === 'childList') {
  1179. // 在创建新的 element 时调用
  1180. var target = $(item.target),
  1181. thisWrapper = target.closest('.conList'),
  1182. nextEle = thisWrapper.next();
  1183. thisWrapper.find('li').css('z-index', 99);
  1184. thisWrapper.find('.cancel-upload-image').show();
  1185. if (nextEle.hasClass('hide-pic-image')) {
  1186. nextEle.removeClass('hide-pic-image');
  1187. }
  1188. }
  1189. });
  1190. });
  1191. // observerImage.observe(observeEleImage, MutationObserverConfigImage);
  1192. // observerImage.observe(observeEleImage1, MutationObserverConfigImage);
  1193. $('body').on('click', '.upload-content-image li', function () {
  1194. var index = $(this).closest('.conList').index() + 1,
  1195. str = 'remarkImage' + index + 'FinderOpen';
  1196. eval(str + '()');
  1197. });
  1198. $('body').on('click', '.cancel-upload-image', function () {
  1199. var wrapper = $(this).closest('.conList');
  1200. wrapper.find('li').css('z-index', '-1');
  1201. wrapper.find('input').val('');
  1202. $(this).hide();
  1203. wrapper.removeClass("hide-pic-image");
  1204. wrapper.parent().append(wrapper.clone());
  1205. wrapper.remove();
  1206. $(".conList").each(function (i, ele) {
  1207. if ($(ele).find("input.input-xlarge").val()) {
  1208. $(ele).next().removeClass("hide-pic-image")
  1209. }
  1210. })
  1211. });
  1212. });
  1213. }
  1214. /**
  1215. * @param obj
  1216. * jquery控制input只能输入数字和两位小数
  1217. */
  1218. function num(obj) {
  1219. obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
  1220. obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
  1221. obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
  1222. obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  1223. obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
  1224. }
  1225. //初始化标签
  1226. $(function () {
  1227. // debugger
  1228. var html = '';
  1229. //解析参数
  1230. var tagsLists = $("#tagsLists").val();
  1231. if (tagsLists != null && tagsLists != "") {
  1232. var tagsArray = tagsLists.split(',');
  1233. for (var j = 0; j < tagsArray.length; j++) {
  1234. html += '<div class="tags-li"><input id="tags" name="tags" value="' + tagsArray[j] + '" class="tags-s" readonly/><i onclick="removerX(this)">X</i></div>';
  1235. }
  1236. $("#tagsList").append(html).show();
  1237. }
  1238. });
  1239. $(window).load(function () {
  1240. loadInitType();
  1241. });
  1242. var step = ${product.step};
  1243. var areaFlag = ${product.allAreaFlag};
  1244. var ladderPriceFlag = ${product.ladderPriceFlag};
  1245. var normalPrice = ${product.price};
  1246. $(document).ready(function () {
  1247. step * 1 > 1 ? $("#setpInput").show() : $("#setpInput").hide();
  1248. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1249. computedPriceLevel(normalPrice);
  1250. if (ladderPriceFlag * 1 > 0) {
  1251. $("#ladderPriceBox").show();
  1252. $("#priceMinNumber").hide();
  1253. } else {
  1254. $("#ladderPriceBox").hide();
  1255. $("#priceMinNumber").show();
  1256. }
  1257. changeCostPriceShow();
  1258. //富文本框
  1259. ClassicEditor.create(document.querySelector('#detailInfoEditor'), {
  1260. ckfinder: {
  1261. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1262. }
  1263. }).then(function (editor) {
  1264. window.detailInfoEditor = editor;
  1265. }).catch(function (error) {
  1266. console.log(error);
  1267. });
  1268. //富文本框
  1269. ClassicEditor.create(document.querySelector('#detailInfoEditor2'), {
  1270. ckfinder: {
  1271. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1272. }
  1273. }).then(function (editor) {
  1274. window.detailInfoEditor2 = editor;
  1275. }).catch(function (error) {
  1276. console.log(error);
  1277. });
  1278. ClassicEditor.create(document.querySelector('#orderInfoEditor'), {
  1279. ckfinder: {
  1280. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1281. }
  1282. }).then(function (editor) {
  1283. window.orderInfoEditor = editor;
  1284. }).catch(function (error) {
  1285. console.log(error);
  1286. });
  1287. ClassicEditor.create(document.querySelector('#serviceInfoEditor'), {
  1288. ckfinder: {
  1289. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1290. }
  1291. }).then(function (editor) {
  1292. window.serviceInfoEditor = editor;
  1293. }).catch(function (error) {
  1294. console.log(error);
  1295. });
  1296. });
  1297. //富文本框编辑
  1298. function checkInfo() {
  1299. // debugger
  1300. var productType= $("#productType").val();
  1301. var qualificationNo= $('#qualificationNo').val()
  1302. var productName= $("#productName").val();
  1303. var qualificationTime= $('#qualificationTime').val()
  1304. var qualificationLink= $("#qualificationLink").val();
  1305. if (productType=="2") {
  1306. if (qualificationNo == null || qualificationNo == "") {
  1307. alertx("请输入证书编号");
  1308. return false;
  1309. }
  1310. if (productName == null || productName == "") {
  1311. alertx("请输入产品名称");
  1312. return false;
  1313. }
  1314. if (qualificationTime == null || qualificationTime == "") {
  1315. alertx("请输入证书有效时间");
  1316. return false;
  1317. }
  1318. if (qualificationLink == null || qualificationLink == "") {
  1319. alertx("请输入证书有效链接");
  1320. return false;
  1321. }
  1322. }
  1323. var detailInfo = detailInfoEditor.getData();
  1324. $("#detailInfo").val(detailInfo);
  1325. var commonDetailInfo = detailInfoEditor2.getData();
  1326. $("#commonDetailInfo").val(commonDetailInfo);
  1327. console.log(detailInfo);
  1328. var orderInfo = orderInfoEditor.getData();
  1329. $("#orderInfo").val(orderInfo);
  1330. console.log(orderInfo);
  1331. var serviceInfo = serviceInfoEditor.getData();
  1332. $("#serviceInfo").val(serviceInfo);
  1333. console.log(serviceInfo);
  1334. }
  1335. $("#ladderPrice1").on("click", ".addBtn", function () {
  1336. $("#ladderPrice2").removeClass("hide");
  1337. $("#delFlag2").val("0");
  1338. $("#ladderPrice1").find(".showBtn").addClass("hide");
  1339. });
  1340. $("#ladderPrice2").on("click", ".addBtn", function () {
  1341. $("#ladderPrice3").removeClass("hide");
  1342. $("#delFlag3").val("0");
  1343. $("#ladderPrice2").find(".showBtn").addClass("hide");
  1344. }).on("click", ".delBtn", function () {
  1345. $("#ladderPrice2").addClass("hide");
  1346. $("#ladderPrice1").find(".showBtn").removeClass("hide");
  1347. $("#delFlag2").val("1");
  1348. });
  1349. $("#ladderPrice3").on("click", ".delBtn", function () {
  1350. $("#ladderPrice3").addClass("hide");
  1351. $("#ladderPrice2").find(".showBtn").removeClass("hide");
  1352. $("#delFlag3").val("1");
  1353. });
  1354. //计算游客用户价格等级
  1355. function computedPriceLevel(price) {
  1356. var priceLevel = 1;
  1357. $(".priceIcon").removeClass("full");
  1358. $(".priceIcon").eq(0).addClass("full");
  1359. if (price * 1 > 2.5 * 10000 && price * 1 <= 10 * 10000) {
  1360. priceLevel = 2;
  1361. $(".priceIcon").addClass("full");
  1362. if ($(".priceIcon").eq(2).hasClass("full")) {
  1363. $(".priceIcon").eq(2).removeClass("full");
  1364. }
  1365. if ($(".priceIcon").eq(3).hasClass("full")) {
  1366. $(".priceIcon").eq(3).removeClass("full");
  1367. }
  1368. if ($(".priceIcon").eq(4).hasClass("full")) {
  1369. $(".priceIcon").eq(4).removeClass("full");
  1370. }
  1371. }
  1372. if (price * 1 > 10 * 10000 && price * 1 <= 25 * 10000) {
  1373. priceLevel = 3;
  1374. $(".priceIcon").addClass("full");
  1375. if ($(".priceIcon").eq(3).hasClass("full")) {
  1376. $(".priceIcon").eq(3).removeClass("full");
  1377. }
  1378. if ($(".priceIcon").eq(4).hasClass("full")) {
  1379. $(".priceIcon").eq(4).removeClass("full");
  1380. }
  1381. }
  1382. if (price * 1 > 25 * 10000 && price * 1 <= 50 * 10000) {
  1383. priceLevel = 4;
  1384. $(".priceIcon").addClass("full");
  1385. if ($(".priceIcon").eq(4).hasClass("full")) {
  1386. $(".priceIcon").eq(4).removeClass("full");
  1387. }
  1388. }
  1389. if (price * 1 > 50 * 10000) {
  1390. priceLevel = 5;
  1391. $(".priceIcon").addClass("full");
  1392. }
  1393. }
  1394. // 检查阶梯数量
  1395. function checkBuyNum(input, index) {
  1396. if (index > 0) {
  1397. var beforeNum = $('input[name="ladderPriceList[' + (index - 1) + '].buyNum"]').val() * 1;
  1398. if (input.value * 1 <= beforeNum) {
  1399. alertx("请输入大于上一阶起订量的值");
  1400. $(input).val(input.value * 1 + beforeNum);
  1401. }
  1402. } else {
  1403. var minNum = $('input[name="ladderPriceList[0].buyNum"]').val() * 1;
  1404. $('#minBuyNumber').val(minNum);
  1405. }
  1406. }
  1407. // 检查阶梯价格
  1408. function checkBuyPrice(input, index) {
  1409. if (index > 0) {
  1410. var beforePrice = $('input[name="ladderPriceList[' + (index - 1) + '].buyPrice"]').val() * 1;
  1411. if (input.value * 1 > beforePrice) {
  1412. $(input).val('');
  1413. alertx("请输入小于前一个价格的值");
  1414. }
  1415. } else {
  1416. var price = $('#price').val();
  1417. if (input.value * 1 > price) {
  1418. $(input).val('');
  1419. alertx("第一个阶梯价格不能大于机构价");
  1420. }
  1421. }
  1422. }
  1423. // 是否使用阶梯价格
  1424. function changeLadderPrice() {
  1425. var ladderPriceFlag = $("input[name='ladderPriceFlag']:checked").val();
  1426. var svipFlag = ${product.svipFlag};
  1427. if (svipFlag == 1) {
  1428. alertx("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
  1429. $("input[name='ladderPriceFlag']").get(0).checked = true;
  1430. } else {
  1431. if (ladderPriceFlag * 1 > 0) {
  1432. $("#ladderPriceBox").show();
  1433. $("#priceMinNumber").hide();
  1434. $("#delFlag1").val("0");
  1435. $('input[name="ladderPriceList[0].buyNum"]').val($('#minBuyNumber').val() * 1);
  1436. } else {
  1437. $("#ladderPriceBox").hide();
  1438. $("#priceMinNumber").show();
  1439. }
  1440. }
  1441. }
  1442. // 是否固定成本
  1443. function changeCostPriceShow() {
  1444. var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  1445. if (costCheckFlag * 1 === 1) {
  1446. $("#costPriceShow").show();
  1447. $("#costPropShow").hide();
  1448. } else {
  1449. $("#costPriceShow").hide();
  1450. $("#costPropShow").show();
  1451. }
  1452. }
  1453. // 全部区域
  1454. function changeAreaFlag() {
  1455. var areaFlag = $("input[name='allAreaFlag']:checked").val();
  1456. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1457. }
  1458. // 网站分类
  1459. var currentBigtype = ${product.bigTypeID};
  1460. var currentSmalltype = ${product.smallTypeID};
  1461. var currentTinytype = ${product.tinyTypeID};
  1462. var currentCommodityType = ${product.commodityType}; //商品属性
  1463. var bigTypeList = [
  1464. <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
  1465. <c:if test="${index.index > 0}">, </c:if>
  1466. {
  1467. bigTypeID: ${bigType.bigTypeID},
  1468. name: "${bigType.name}",
  1469. typeSort: ${bigType.typeSort}
  1470. }
  1471. </c:forEach>
  1472. ];
  1473. var smalltypeList = [
  1474. <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
  1475. <c:if test="${index.index > 0}">, </c:if>
  1476. {
  1477. smallTypeID: ${smalltype.smallTypeID},
  1478. name: "${smalltype.name}",
  1479. bigTypeID: ${smalltype.bigTypeID},
  1480. }
  1481. </c:forEach>
  1482. ];
  1483. var tinytypeList = [
  1484. <c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
  1485. <c:if test="${index.index > 0}">, </c:if>
  1486. {
  1487. tinyTypeID: ${tinytype.tinyTypeID},
  1488. name: "${tinytype.name}",
  1489. smallTypeID: ${tinytype.smallTypeID}
  1490. }
  1491. </c:forEach>
  1492. ];
  1493. // 初始分类
  1494. function loadInitType() {
  1495. if (currentCommodityType == null || typeof (currentCommodityType) == "undefined" || currentCommodityType == '0') {
  1496. $("#bigType").html("");
  1497. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1498. $("#bigType").append("<option value=''>请选择</option>");
  1499. $("#smallType").html("");
  1500. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1501. $("#smallType").append("<option value=''>请选择</option>");
  1502. $("#tinyType").html("");
  1503. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1504. $("#tinyType").append("<option value=''>请选择</option>");
  1505. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1506. } else if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
  1507. setTimeout(function () {
  1508. loadBigType();
  1509. }, 0);
  1510. }
  1511. }
  1512. // 分类联动
  1513. function loadBigType() {
  1514. var commodityType = $("input[name='commodityType']:checked").val();
  1515. $("#bigType").html("");
  1516. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1517. $("#bigType").append("<option value=''>请选择</option>");
  1518. $("#smallType").html("");
  1519. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1520. $("#smallType").append("<option value=''>请选择</option>");
  1521. $("#tinyType").html("");
  1522. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1523. $("#tinyType").append("<option value=''>请选择</option>");
  1524. if (typeof (commodityType) != "undefined") {
  1525. $("#bigType").html("");
  1526. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1527. $("#bigType").append("<option value=''>请选择</option>");
  1528. $("#smallType").html("");
  1529. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1530. $("#smallType").append("<option value=''>请选择</option>");
  1531. $("#tinyType").html("");
  1532. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1533. $("#tinyType").append("<option value=''>请选择</option>");
  1534. for (var i = 0; i < bigTypeList.length; i++) {
  1535. if (commodityType == bigTypeList[i].typeSort) {
  1536. if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeID) {
  1537. $("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1538. $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
  1539. setTimeout(function () {
  1540. loadSmallType();
  1541. }, 500);
  1542. } else {
  1543. $("#bigType").append("<option value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1544. }
  1545. }
  1546. }
  1547. }
  1548. loadSmallType();
  1549. trainingShow();
  1550. }
  1551. function loadSmallType(id) {
  1552. if (id) {
  1553. $("#bigType").val(id);
  1554. $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
  1555. }
  1556. var bigType = $("#bigType").val();
  1557. $("#smallType").html("");
  1558. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1559. $("#smallType").append("<option value=''>请选择</option>");
  1560. $("#tinyType").html("");
  1561. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1562. $("#tinyType").append("<option value=''>请选择</option>");
  1563. if (typeof (bigType) != "undefined" && bigType != "") {
  1564. var smallTypeNum = 0;
  1565. for (var i = 0; i < smalltypeList.length; i++) {
  1566. if (bigType == smalltypeList[i].bigTypeID) {
  1567. smallTypeNum = smallTypeNum + 1;
  1568. if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
  1569. $("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1570. $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
  1571. setTimeout(function () {
  1572. loadTinyType(currentSmalltype);
  1573. }, 500);
  1574. } else {
  1575. $("#smallType").append("<option value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1576. }
  1577. }
  1578. }
  1579. if (smallTypeNum == 0) {
  1580. $("#smallType").removeClass("required");
  1581. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1582. } else {
  1583. $("#smallType").addClass("required");
  1584. document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
  1585. }
  1586. } else {
  1587. $("#smallType").removeClass("required");
  1588. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1589. }
  1590. loadTinyType();
  1591. }
  1592. function loadTinyType(id) {
  1593. if (id) {
  1594. $("#smallType").val(id);
  1595. $("#smallType").prev().find(".select2-chosen").text($("#smallType option:selected").text());
  1596. }
  1597. var smallType = $("#smallType option:selected").val();
  1598. $("#tinyType").html("");
  1599. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1600. $("#tinyType").append("<option value=''>请选择</option>");
  1601. if (typeof (smallType) != "undefined" && smallType != "") {
  1602. var tinyTypeNum = 0;
  1603. for (var i = 0; i < tinytypeList.length; i++) {
  1604. if (smallType == tinytypeList[i].smallTypeID) {
  1605. tinyTypeNum = tinyTypeNum + 1;
  1606. if (currentTinytype != null && typeof (currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
  1607. $("#tinyType").append("<option selected value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1608. $("#tinyType").prev().find(".select2-chosen").text(tinytypeList[i].name);
  1609. } else {
  1610. $("#tinyType").append("<option value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1611. }
  1612. }
  1613. }
  1614. if (tinyTypeNum == 0) {
  1615. $("#tinyType").removeClass("required");
  1616. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1617. } else {
  1618. $("#tinyType").addClass("required");
  1619. document.getElementById("s2id_tinyType").style.cssText = "display: inline-block";
  1620. }
  1621. } else {
  1622. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1623. $("#tinyType").removeClass("required");
  1624. }
  1625. }
  1626. //验证字符串最大长度
  1627. function checkmaxlength(str) {
  1628. var realLength = 0;
  1629. for (var i = 0; i < str.length; i++) {
  1630. charCode = str.charCodeAt(i);
  1631. if (charCode >= 0 && charCode <= 128)
  1632. realLength += 1;
  1633. else
  1634. realLength += 2;
  1635. }
  1636. if (realLength > 100) {
  1637. alertx("商品名称最多50个汉字,即100个字符!当前输入长度为" + realLength);
  1638. }
  1639. }
  1640. //验证字符串最大长度
  1641. function checkmaxlengths(str, maxlength) {
  1642. var realLength = 0;
  1643. for (var i = 0; i < str.length; i++) {
  1644. charCode = str.charCodeAt(i);
  1645. if (charCode >= 0 && charCode <= 128)
  1646. realLength += 1;
  1647. else
  1648. realLength += 2;
  1649. }
  1650. if (realLength > maxlength) {
  1651. alertx("商品名称最多30个汉字,即60个字符!当前输入长度为" + realLength);
  1652. }
  1653. }
  1654. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  1655. var realLength = 0;
  1656. var maxChange = "1";
  1657. for (var i = 0; i < str.length; i++) {
  1658. charCode = str.charCodeAt(i);
  1659. if (charCode >= 0 && charCode <= 128)
  1660. realLength += 1;
  1661. else {
  1662. realLength += 2;
  1663. maxChange = "2";
  1664. }
  1665. }
  1666. if (maxChange == "2") {
  1667. var s = str.substr(0, 16);
  1668. $(searckThis).val(s);
  1669. }
  1670. if (realLength > maxlength) {
  1671. alertx("关键字最多16个汉字,即32个字符!");
  1672. }
  1673. }
  1674. function checkPrecisehKeyLength(str) {
  1675. var realLength = 0;
  1676. for (var i = 0; i < str.length; i++) {
  1677. charCode = str.charCodeAt(i);
  1678. if (charCode >= 0 && charCode <= 128)
  1679. realLength += 1;
  1680. else
  1681. realLength += 2;
  1682. }
  1683. if (realLength > 160) {
  1684. alertx("精确关键词最多80个汉字,即160个字符!当前输入长度为" + realLength);
  1685. }
  1686. }
  1687. // 添加相关参数
  1688. var productParametersIndex = $('#productParametersLength').val() - 1;
  1689. $(".addParams").click(function () {
  1690. var val = $("#paramsName").val();
  1691. // alertx("+++++"+val.length)
  1692. productParametersIndex++;
  1693. var html = '<div id="paramsItem" class="paramsItem">';
  1694. html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsName" id="paramsName" style="width:142px" maxlength="10" placeholder="参数名称" type="text" class="input-small"/>&nbsp;';
  1695. html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsContent" id="paramsContent" style="width:680px" maxlength="50" placeholder="请输入参数信息" type="text" class="input-small"/>&nbsp;';
  1696. html += '<span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)"">删除</span>';
  1697. html += '</div>';
  1698. $("#addParamsItems").append(html).show();
  1699. var paramsItemLength = $('.paramsItem').length;
  1700. if (paramsItemLength === 50) {
  1701. $(this).hide();
  1702. return
  1703. }
  1704. });
  1705. //添加标签
  1706. $(".addTags").click(function () {
  1707. // 获取输入新标签
  1708. var val = $("#inputTags").val();
  1709. // 清空输入框输入
  1710. $("#inputTags").val("");
  1711. if (null === val || "" === val) {
  1712. alertx("请输入商品标签");
  1713. return;
  1714. }
  1715. // 添加新标签
  1716. $("#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();
  1717. var tagsLength = $('.tags-li').length;
  1718. if (tagsLength === 6) {
  1719. $(this).hide();
  1720. return
  1721. }
  1722. });
  1723. /**
  1724. * 删除对于标签
  1725. */
  1726. function removerX(ithis) {
  1727. $(ithis).parent().remove();
  1728. var tagsLength = $('.tags-li').length;
  1729. if (tagsLength < 6) {
  1730. $('.addTags').show();
  1731. }
  1732. }
  1733. //初始化商品类型
  1734. $(function () {
  1735. changeMachine();
  1736. })
  1737. function changeMachine() {
  1738. var val = $("#productType").val();
  1739. // 0其它,1妆字号,2械字号
  1740. if (val == 1 || val == 0) {
  1741. //隐藏械字号
  1742. $(".machineType").hide();
  1743. } else if (val == 2) {
  1744. // 显示械字号
  1745. $(".machineType").show();
  1746. }
  1747. }
  1748. //初始化含税信息
  1749. $(function () {
  1750. var includedTax = $("input[name='includedTax']:checked").val();
  1751. var invoiceType = $("input[name='invoiceType']:checked").val();
  1752. var taxPoint = $("#taxPoint").val();
  1753. //1含税,0不含税
  1754. if (includedTax == 1) {
  1755. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
  1756. $("#taxPointDiv").show();
  1757. $("#supplierTaxPointDiv").show();
  1758. }
  1759. if (includedTax == 0) {
  1760. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
  1761. // 选择增值税且不为不开发票
  1762. if (invoiceType == 3) {
  1763. $("#taxPointDiv").hide();
  1764. $("#supplierTaxPointDiv").hide();
  1765. } else {
  1766. $("#taxPointDiv").show();
  1767. $("#supplierTaxPointDiv").show();
  1768. }
  1769. }
  1770. if (includedTax == 2) {
  1771. $("#invoiceItem").hide();
  1772. $("#taxPointDiv").hide();
  1773. $("#supplierTaxPointDiv").hide();
  1774. }
  1775. if (includedTax == "" || includedTax == null) {
  1776. $("#invoiceItem").hide();
  1777. $("#taxPointDiv").hide();
  1778. $("#supplierTaxPointDiv").hide();
  1779. }
  1780. //发票初始化
  1781. if (includedTax == 0 && (invoiceType == 1 || invoiceType == 2)) {
  1782. $("#taxPointDiv").show();
  1783. $("#supplierTaxPointDiv").show();
  1784. }
  1785. if (includedTax == 1) {//含税
  1786. // 一个都没选中默认选中增值税
  1787. if (invoiceType != 1 && invoiceType != 2) {
  1788. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  1789. }
  1790. } else if (includedTax == 0) {//不含税
  1791. // 一个都没选中默认选中增值税
  1792. if (invoiceType != 1 && invoiceType != 2 && invoiceType != 3) {
  1793. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  1794. }
  1795. if (invoiceType == 1) {//增值税
  1796. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  1797. if (taxPoint == null || taxPoint == "") {
  1798. $("#taxPoint").val(13);
  1799. }
  1800. } else if (invoiceType == 2) {//普通发票
  1801. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  1802. if (taxPoint == null || taxPoint == "") {
  1803. $("#taxPoint").val(6);
  1804. }
  1805. }
  1806. }
  1807. });
  1808. /**
  1809. * @param obj
  1810. * jquery控制input只能输入数字
  1811. */
  1812. function onlynum(obj) {
  1813. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  1814. }
  1815. function chageIncludedTax(taxPointValue) {
  1816. //修改选择项
  1817. var includedTax = $("input[name='includedTax']:checked").val();
  1818. var invoiceType = $("input[name='invoiceType']:checked").val();
  1819. var taxPoint = taxPointValue;
  1820. //1含税,0不含税,2未知
  1821. if (includedTax == 1) {
  1822. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
  1823. $("#taxPointDiv").show();
  1824. $("#supplierTaxPointDiv").show();
  1825. }
  1826. if (includedTax == 0) {
  1827. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
  1828. // 选择增值税且不为不开发票
  1829. if (invoiceType == 3) {
  1830. $("#taxPointDiv").hide();
  1831. $("#supplierTaxPointDiv").hide();
  1832. } else {
  1833. $("#taxPointDiv").show();
  1834. $("#supplierTaxPointDiv").show();
  1835. }
  1836. }
  1837. if (includedTax == 2) {
  1838. $("#invoiceItem").hide();
  1839. $("#taxPointDiv").hide();
  1840. $("#supplierTaxPointDiv").hide();
  1841. }
  1842. if (includedTax == "" || includedTax == null) {
  1843. $("#invoiceItem").hide();
  1844. $("#taxPointDiv").hide();
  1845. $("#supplierTaxPointDiv").hide();
  1846. }
  1847. if (includedTax == 1) {//含税
  1848. // 一个都没选中默认选中增值税
  1849. if (invoiceType != 1 && invoiceType != 2) {
  1850. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  1851. }
  1852. } else if (includedTax == 0) {//不含税
  1853. // 一个都没选中默认选中增值税
  1854. if (invoiceType != 1 && invoiceType != 2 && invoiceType != 3) {
  1855. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  1856. }
  1857. }
  1858. invoiceType = $("input[name='invoiceType']:checked").val();
  1859. if (invoiceType == 1) {//增值税
  1860. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  1861. if (taxPoint == null || taxPoint == "") {
  1862. $("#taxPoint").val(13);
  1863. $("#supplierTaxPoint").val(13);
  1864. }
  1865. } else if (invoiceType == 2) {//普通发票
  1866. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  1867. if (taxPoint == null || taxPoint == "") {
  1868. $("#taxPoint").val(6);
  1869. $("#supplierTaxPoint").val(6);
  1870. }
  1871. }
  1872. }
  1873. //选择发票类型
  1874. function changeInvoiceType(taxPointValue) {
  1875. var taxPoint = taxPointValue;
  1876. var includedTax = $("input[name='includedTax']:checked").val();
  1877. //选择发票类型:1增值税票,2普通票, 3不能开票
  1878. var invoiceType = $("input[name='invoiceType']:checked").val();
  1879. //只有在选择了不含税才使用税点,不含税里面的
  1880. if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
  1881. $("#taxPointDiv").show();
  1882. $("#supplierTaxPointDiv").show();
  1883. } else {
  1884. $("#taxPointDiv").hide();
  1885. $("#supplierTaxPointDiv").hide();
  1886. }
  1887. if (invoiceType == 1) {//增值税
  1888. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  1889. if (taxPoint == null || taxPoint == "") {
  1890. $("#taxPoint").val(13);
  1891. $("#supplierTaxPoint").val(13);
  1892. }
  1893. } else if (invoiceType == 2) {//普通发票
  1894. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  1895. if (taxPoint == null || taxPoint == "") {
  1896. $("#taxPoint").val(6);
  1897. $("#supplierTaxPoint").val(6);
  1898. }
  1899. }
  1900. }
  1901. //删除相关参数
  1902. function deleteParams(paramsThis) {
  1903. $(paramsThis).parent().remove();
  1904. var paramsItemLength = $('.paramsItem').length;
  1905. if (paramsItemLength < 50) {
  1906. $('.addParams').show();
  1907. }
  1908. }
  1909. //限制两位小数
  1910. function setTwoNumberDecimal(that) {
  1911. var n = parseFloat(that.value);
  1912. that.value = n.toFixed(2)
  1913. }
  1914. //培训相关显示
  1915. function trainingShow() {
  1916. var commodityType = $("input[name='commodityType']:checked").val();
  1917. var trainingType = $("input[name='trainingType']:checked").val();
  1918. if (commodityType == 2) {
  1919. $(".training").show();
  1920. if (trainingType == 1) {
  1921. $("#trainingFee").show();
  1922. } else {
  1923. $("#trainingFee").hide();
  1924. }
  1925. } else {
  1926. $(".training").hide();
  1927. $("#trainingFee").hide();
  1928. }
  1929. }
  1930. </script>
  1931. </body>
  1932. </html>