productEdit.jsp 101 KB

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