productEdit.jsp 99 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330
  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">
  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">
  849. /*$(function () {
  850. // debugger
  851. var productType= $("#productType").val();
  852. if (productType=="2"){
  853. $("#s2id_priceFlag").val(3);
  854. $("#s2id_visibility").val(4);
  855. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  856. $("#priceFlag").prev().find(".select2-chosen").text("仅对医美机构开放");
  857. $("#priceFlag").prop("disabled",true);
  858. $("#visibility").prop("disabled",true);
  859. }
  860. });*/
  861. function js() {
  862. var val = $("#productType").val();
  863. var mac = $("#machineType").val();
  864. if (val == '2') {
  865. if (mac == '1') {
  866. // 械字号一类
  867. $("#visibility").val(3);
  868. $("#priceFlag").val(0);
  869. $("#commodityDetailsFlag").val(1);
  870. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  871. $("#priceFlag").prev().find(".select2-chosen").text("对所有机构公开");
  872. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("所有人可见");
  873. } else if (mac == '2') {
  874. // 械字号二类
  875. $("#visibility").val(3);
  876. $("#priceFlag").val(3);
  877. $("#commodityDetailsFlag").val(4);
  878. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  879. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  880. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  881. } else if (mac == '3') {
  882. // 械字号三类
  883. $("#visibility").val(3);
  884. $("#priceFlag").val(3);
  885. $("#commodityDetailsFlag").val(4);
  886. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  887. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  888. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  889. }
  890. } else {
  891. $("#priceFlag").prop("disabled", false);
  892. $("#visibility").prop("disabled", false);
  893. $("#commodityDetailsFlag").prop("disabled", false);
  894. }
  895. }
  896. $(document).ready(function () {
  897. $('body').on('keyup', '#wipeRemarks', function () {
  898. $('#remarkLen').text($(this).val().length);
  899. });
  900. //$("#name").focus();
  901. $("#inputForm").validate({
  902. ignore: "",
  903. submitHandler: function (form) {
  904. var commodityType = $("input[name='commodityType']:checked").val();
  905. if (commodityType == '' || commodityType == null) {
  906. alertx("请选择商品属性");
  907. return false;
  908. }
  909. var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  910. if (costCheckFlag * 1 === 1) {
  911. if ($("#costPrice").val() == '') {
  912. alertx("请输入成本价");
  913. return false;
  914. }
  915. ;
  916. } else {
  917. if ($("#costProportional").val() == '') {
  918. alertx("请输入成本比例");
  919. return false;
  920. }
  921. ;
  922. }
  923. if ($('#minBuyNumber:visible').length > 0) {
  924. var minBuyNumber = $('#minBuyNumber').val();
  925. if (minBuyNumber <= 0 || minBuyNumber == '') {
  926. alertx("请输入起订量");
  927. return false;
  928. }
  929. }
  930. if ($('input[name="ladderPriceList[0].buyNum"]:visible').length > 0) {
  931. var buyNum = $('input[name="ladderPriceList[0].buyNum"]').val();
  932. var buyPrice = $('input[name="ladderPriceList[0].buyPrice"]').val();
  933. if (buyNum <= 0 || buyNum == '' || buyPrice <= 0 || buyPrice == '') {
  934. alertx("请输入正确的阶梯价格");
  935. return false;
  936. }
  937. }
  938. if ($('input[name="ladderPriceList[1].buyNum"]:visible').length > 0) {
  939. var buyNum1 = $('input[name="ladderPriceList[1].buyNum"]').val();
  940. var buyPrice1 = $('input[name="ladderPriceList[1].buyPrice"]').val();
  941. if (buyNum1 <= 0 || buyNum1 == '' || buyPrice1 <= 0 || buyPrice1 == '') {
  942. alertx("请输入正确的阶梯价格");
  943. return false;
  944. }
  945. }
  946. if ($('input[name="ladderPriceList[2].buyNum"]:visible').length > 0) {
  947. var buyNum2 = $('input[name="ladderPriceList[2].buyNum"]').val();
  948. var buyPrice2 = $('input[name="ladderPriceList[2].buyPrice"]').val();
  949. if (buyNum2 <= 0 || buyNum2 == '' || buyPrice2 <= 0 || buyPrice2 == '') {
  950. alertx("请输入正确的阶梯价格");
  951. return false;
  952. }
  953. }
  954. var detailInfo = detailInfoEditor.getData();
  955. if (detailInfo == '') {
  956. alertx("请输入商品详细信息");
  957. return false;
  958. }
  959. var includedTax = $("input[name='includedTax']:checked").val();
  960. if (includedTax == '' || includedTax == null) {
  961. alertx("请选择是否含税");
  962. return false;
  963. }
  964. var invoiceType = $("input[name='invoiceType']:checked").val();
  965. if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
  966. var taxPoint = $("#taxPoint").val();
  967. var supplierTaxPoint = $("#supplierTaxPoint").val();
  968. if (taxPoint == '' || taxPoint == null) {
  969. alertx("请输入机构税率");
  970. return false;
  971. }
  972. if (supplierTaxPoint == '' || supplierTaxPoint == null) {
  973. alertx("请输入供应商税率");
  974. return false;
  975. }
  976. }
  977. if (includedTax != ${product.includedTax} || invoiceType != ${product.invoiceType}) {
  978. 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) {
  979. if (v == 'ok') {
  980. // 提交订单
  981. loading('正在提交,请稍等...');
  982. form.submit();
  983. }
  984. }, {
  985. buttonsFocus: 1, closed: function () {
  986. if (typeof closed == 'function') {
  987. closed();
  988. }
  989. }
  990. });
  991. } else {
  992. loading('正在提交,请稍等...');
  993. form.submit();
  994. }
  995. },
  996. errorContainer: "#messageBox",
  997. errorPlacement: function (error, element) {
  998. $("#messageBox").text("输入有误,请先更正。");
  999. if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
  1000. error.appendTo(element.parent().parent());
  1001. } else {
  1002. error.insertAfter(element);
  1003. }
  1004. }
  1005. });
  1006. // 初始化sku
  1007. insertDefaultSkuRow();
  1008. });
  1009. <%--// 商品可见度--%>
  1010. <%--/*$(function() {--%>
  1011. <%-- var initValue = ${(product.visibility <= 0) ? 3 : ((product.visibility >= 3) ? 3 : product.visibility)}--%>
  1012. <%-- var select = $("#visibility");--%>
  1013. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1014. <%-- min: 1,--%>
  1015. <%-- max: 3,--%>
  1016. <%-- range: "min",--%>
  1017. <%-- value: initValue,--%>
  1018. <%-- slide: function(event, ui) {--%>
  1019. <%-- if (ui.value*1 === 1){--%>
  1020. <%-- // 所有可见--%>
  1021. <%-- select.val(1);--%>
  1022. <%-- } else if (ui.value*1 === 2){--%>
  1023. <%-- // 会员可见--%>
  1024. <%-- select.val(2);--%>
  1025. <%-- } else{--%>
  1026. <%-- // 不可见--%>
  1027. <%-- select.val(3);--%>
  1028. <%-- }--%>
  1029. <%-- $("#visibilityNote").text(select.find("option:selected").text());--%>
  1030. <%-- }--%>
  1031. <%-- });--%>
  1032. <%--});*/--%>
  1033. <%--// 价格可见度: 1不公开价格,3仅对医美机构公开,2仅对会员机构公开,0公开价格--%>
  1034. <%--// 对应滑块:1->2->3->4--%>
  1035. <%--$(function() {--%>
  1036. <%-- var initValue = ${(product.priceFlag eq 0) ? 2 : ((product.priceFlag eq 2) ? 1 : 0)}--%>
  1037. <%-- var initValue = ${(product.priceFlag eq 1) ? 1 : ((product.priceFlag eq 3) ? 2 : ((product.priceFlag eq 2) ? 3 : 4))}--%>
  1038. <%-- var select = $("#priceFlag");--%>
  1039. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1040. <%-- min: 1,--%>
  1041. <%-- max: 4,--%>
  1042. <%-- range: "min",--%>
  1043. <%-- value: initValue,--%>
  1044. <%-- slide: function(event, ui) {--%>
  1045. <%-- if (ui.value*1 === 4){--%>
  1046. <%-- // 所有可见--%>
  1047. <%-- select.val(0);--%>
  1048. <%-- } else if (ui.value*1 === 3){--%>
  1049. <%-- // 会员可见--%>
  1050. <%-- select.val(2);--%>
  1051. <%-- } else if (ui.value*1 === 2){--%>
  1052. <%-- // 医美可见--%>
  1053. <%-- select.val(3);--%>
  1054. <%-- } else{--%>
  1055. <%-- // 不可见--%>
  1056. <%-- select.val(1);--%>
  1057. <%-- }--%>
  1058. <%-- //select[0].selectedIndex = ui.value;--%>
  1059. <%-- $("#textFlagNote").text(select.find("option:selected").text());--%>
  1060. <%-- }--%>
  1061. <%-- });--%>
  1062. <%--});--%>
  1063. function getCodes(data) {
  1064. var opts = "<option value=''>请选择</option>";
  1065. $.ajax({
  1066. type: "POST",
  1067. url: "${ctx}/product/new/getCodes",
  1068. data: {"shopId": data},
  1069. success: function (res) {
  1070. console.log("data------------------->" + res)
  1071. for (let i = 0; i < res.length; i++) {
  1072. opts += "<option value='" + res[i].splitCode + "'>" + res[i].codeName + "</option>";
  1073. }
  1074. console.log(opts);
  1075. $("#getCode").html('').append(opts);
  1076. },
  1077. error: function (res) {
  1078. }
  1079. });
  1080. }
  1081. //图片初始化
  1082. if (${product.shopType == 2}) {
  1083. $(function () {
  1084. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  1085. var realLength = 0;
  1086. var maxChange = "1";
  1087. for (var i = 0; i < str.length; i++) {
  1088. charCode = str.charCodeAt(i);
  1089. if (charCode >= 0 && charCode <= 128)
  1090. realLength += 1;
  1091. else {
  1092. realLength += 2;
  1093. maxChange = "2";
  1094. }
  1095. }
  1096. if (maxChange == "2") {
  1097. var s = str.substr(0, 16);
  1098. $(searckThis).val(s);
  1099. }
  1100. if (realLength > maxlength) {
  1101. alertx("关键字最多16个汉字,即32个字符!");
  1102. }
  1103. }
  1104. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1105. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  1106. $('.upload-content .conList').find('.cancel-upload').hide();
  1107. var observeEle = document.getElementsByClassName('upload-content')[0];
  1108. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  1109. var MutationObserverConfig = {
  1110. childList: true,
  1111. subtree: true,
  1112. characterData: true
  1113. };
  1114. var observer = new MutationObserver(function (mutations) {
  1115. $.each(mutations, function (index, item) {
  1116. if (item.type === 'childList') {
  1117. // 在创建新的 element 时调用
  1118. var target = $(item.target),
  1119. thisWrapper = target.closest('.conList'),
  1120. nextEle = thisWrapper.next();
  1121. thisWrapper.find('li').css('z-index', 99);
  1122. thisWrapper.find('.cancel-upload').show();
  1123. if (nextEle.hasClass('hide-pic')) {
  1124. nextEle.removeClass('hide-pic');
  1125. }
  1126. }
  1127. })
  1128. });
  1129. observer.observe(observeEle, MutationObserverConfig);
  1130. $('body').on('click', '.upload-content li', function () {
  1131. var index = $(this).closest('.conList').index() + 1,
  1132. str = 'image' + index + 'FinderOpen';
  1133. eval(str + '()');
  1134. });
  1135. $('body').on('click', '.cancel-upload', function () {
  1136. var wrapper = $(this).closest('.conList');
  1137. wrapper.find('li').css('z-index', '-1');
  1138. wrapper.find('input').val('');
  1139. $(this).hide();
  1140. if ($('.cancel-upload:visible').length < 5) {
  1141. wrapper.addClass("hide-pic");
  1142. } else {
  1143. wrapper.removeClass("hide-pic");
  1144. }
  1145. wrapper.parent().append(wrapper.clone());
  1146. wrapper.remove();
  1147. $(".conList").each(function (i, ele) {
  1148. if ($(ele).find("input.input-xlarge").val()) {
  1149. $(ele).next().removeClass("hide-pic")
  1150. }
  1151. })
  1152. });
  1153. $(window).on("load", function () {
  1154. setTimeout(function () {
  1155. $("#secondHandImage").find("input.input-xlarge").each(function (i, ele) {
  1156. if ($(ele).val()) {
  1157. $(ele).next().find("li").css("z-index", "99");
  1158. $(ele).parents(".conList").find(".cancel-upload").show();
  1159. $(ele).parents(".conList").next().removeClass("hide-pic")
  1160. }
  1161. })
  1162. }, 500);
  1163. });
  1164. $('.upload-content-image .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1165. $('.upload-content-image .conList .btn:nth-of-type(2)').after('<img class="cancel-upload-image" src="/static/images/close-btn1.png">').remove();
  1166. $('.upload-content-image .conList').find('.cancel-upload-image').hide();
  1167. var observeEleImage = document.getElementsByClassName('upload-content-image')[0];
  1168. // var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
  1169. var MutationObserverImage = window.MutationObserver || window.WebKitMutationObserver;
  1170. var MutationObserverConfigImage = {
  1171. childList: true,
  1172. subtree: true,
  1173. characterData: true
  1174. };
  1175. var observerImage = new MutationObserverImage(function (mutations) {
  1176. $.each(mutations, function (index, item) {
  1177. if (item.type === 'childList') {
  1178. // 在创建新的 element 时调用
  1179. var target = $(item.target),
  1180. thisWrapper = target.closest('.conList'),
  1181. nextEle = thisWrapper.next();
  1182. thisWrapper.find('li').css('z-index', 99);
  1183. thisWrapper.find('.cancel-upload-image').show();
  1184. if (nextEle.hasClass('hide-pic-image')) {
  1185. nextEle.removeClass('hide-pic-image');
  1186. }
  1187. }
  1188. });
  1189. });
  1190. // observerImage.observe(observeEleImage, MutationObserverConfigImage);
  1191. // observerImage.observe(observeEleImage1, MutationObserverConfigImage);
  1192. $('body').on('click', '.upload-content-image li', function () {
  1193. var index = $(this).closest('.conList').index() + 1,
  1194. str = 'remarkImage' + index + 'FinderOpen';
  1195. eval(str + '()');
  1196. });
  1197. $('body').on('click', '.cancel-upload-image', function () {
  1198. var wrapper = $(this).closest('.conList');
  1199. wrapper.find('li').css('z-index', '-1');
  1200. wrapper.find('input').val('');
  1201. $(this).hide();
  1202. wrapper.removeClass("hide-pic-image");
  1203. wrapper.parent().append(wrapper.clone());
  1204. wrapper.remove();
  1205. $(".conList").each(function (i, ele) {
  1206. if ($(ele).find("input.input-xlarge").val()) {
  1207. $(ele).next().removeClass("hide-pic-image")
  1208. }
  1209. })
  1210. });
  1211. });
  1212. }
  1213. /**
  1214. * @param obj
  1215. * jquery控制input只能输入数字和两位小数
  1216. */
  1217. function num(obj) {
  1218. obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
  1219. obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
  1220. obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
  1221. obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  1222. obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
  1223. }
  1224. //初始化标签
  1225. $(function () {
  1226. // debugger
  1227. var html = '';
  1228. //解析参数
  1229. var tagsLists = $("#tagsLists").val();
  1230. if (tagsLists != null && tagsLists != "") {
  1231. var tagsArray = tagsLists.split(',');
  1232. for (var j = 0; j < tagsArray.length; j++) {
  1233. html += '<div class="tags-li"><input id="tags" name="tags" value="' + tagsArray[j] + '" class="tags-s" readonly/><i onclick="removerX(this)">X</i></div>';
  1234. }
  1235. $("#tagsList").append(html).show();
  1236. }
  1237. });
  1238. $(window).load(function () {
  1239. loadInitType();
  1240. });
  1241. var step = ${product.step};
  1242. var areaFlag = ${product.allAreaFlag};
  1243. <%--var ladderPriceFlag = ${product.ladderPriceFlag};--%>
  1244. <%--var normalPrice = ${product.price};--%>
  1245. $(document).ready(function () {
  1246. step * 1 > 1 ? $("#setpInput").show() : $("#setpInput").hide();
  1247. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1248. // computedPriceLevel(normalPrice);
  1249. // if (ladderPriceFlag * 1 > 0) {
  1250. // $("#ladderPriceBox").show();
  1251. // $("#priceMinNumber").hide();
  1252. // } else {
  1253. // $("#ladderPriceBox").hide();
  1254. // $("#priceMinNumber").show();
  1255. // }
  1256. // changeCostPriceShow();
  1257. //富文本框
  1258. ClassicEditor.create(document.querySelector('#detailInfoEditor'), {
  1259. ckfinder: {
  1260. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1261. }
  1262. }).then(function (editor) {
  1263. window.detailInfoEditor = editor;
  1264. }).catch(function (error) {
  1265. console.log(error);
  1266. });
  1267. //富文本框
  1268. ClassicEditor.create(document.querySelector('#detailInfoEditor2'), {
  1269. ckfinder: {
  1270. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1271. }
  1272. }).then(function (editor) {
  1273. window.detailInfoEditor2 = editor;
  1274. }).catch(function (error) {
  1275. console.log(error);
  1276. });
  1277. ClassicEditor.create(document.querySelector('#orderInfoEditor'), {
  1278. ckfinder: {
  1279. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1280. }
  1281. }).then(function (editor) {
  1282. window.orderInfoEditor = editor;
  1283. }).catch(function (error) {
  1284. console.log(error);
  1285. });
  1286. ClassicEditor.create(document.querySelector('#serviceInfoEditor'), {
  1287. ckfinder: {
  1288. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1289. }
  1290. }).then(function (editor) {
  1291. window.serviceInfoEditor = editor;
  1292. }).catch(function (error) {
  1293. console.log(error);
  1294. });
  1295. });
  1296. //富文本框编辑
  1297. function checkInfo() {
  1298. // debugger
  1299. var productType = $("#productType").val();
  1300. var qualificationNo = $('#qualificationNo').val()
  1301. var productName = $("#productName").val();
  1302. var qualificationTime = $('#qualificationTime').val()
  1303. var qualificationLink = $("#qualificationLink").val();
  1304. if (productType == "2") {
  1305. if (qualificationNo == null || qualificationNo == "") {
  1306. alertx("请输入证书编号");
  1307. return false;
  1308. }
  1309. if (productName == null || productName == "") {
  1310. alertx("请输入产品名称");
  1311. return false;
  1312. }
  1313. if (qualificationTime == null || qualificationTime == "") {
  1314. alertx("请输入证书有效时间");
  1315. return false;
  1316. }
  1317. if (qualificationLink == null || qualificationLink == "") {
  1318. alertx("请输入证书有效链接");
  1319. return false;
  1320. }
  1321. }
  1322. var detailInfo = detailInfoEditor.getData();
  1323. $("#detailInfo").val(detailInfo);
  1324. var commonDetailInfo = detailInfoEditor2.getData();
  1325. $("#commonDetailInfo").val(commonDetailInfo);
  1326. console.log(detailInfo);
  1327. var orderInfo = orderInfoEditor.getData();
  1328. $("#orderInfo").val(orderInfo);
  1329. console.log(orderInfo);
  1330. var serviceInfo = serviceInfoEditor.getData();
  1331. $("#serviceInfo").val(serviceInfo);
  1332. console.log(serviceInfo);
  1333. }
  1334. // $("#ladderPrice1").on("click", ".addBtn", function () {
  1335. // $("#ladderPrice2").removeClass("hide");
  1336. // $("#delFlag2").val("0");
  1337. // $("#ladderPrice1").find(".showBtn").addClass("hide");
  1338. // });
  1339. // $("#ladderPrice2").on("click", ".addBtn", function () {
  1340. // $("#ladderPrice3").removeClass("hide");
  1341. // $("#delFlag3").val("0");
  1342. // $("#ladderPrice2").find(".showBtn").addClass("hide");
  1343. // }).on("click", ".delBtn", function () {
  1344. // $("#ladderPrice2").addClass("hide");
  1345. // $("#ladderPrice1").find(".showBtn").removeClass("hide");
  1346. // $("#delFlag2").val("1");
  1347. // });
  1348. // $("#ladderPrice3").on("click", ".delBtn", function () {
  1349. // $("#ladderPrice3").addClass("hide");
  1350. // $("#ladderPrice2").find(".showBtn").removeClass("hide");
  1351. // $("#delFlag3").val("1");
  1352. // });
  1353. //计算游客用户价格等级
  1354. function computedPriceLevel(price) {
  1355. var priceLevel = 1;
  1356. $(".priceIcon").removeClass("full");
  1357. $(".priceIcon").eq(0).addClass("full");
  1358. if (price * 1 > 2.5 * 10000 && price * 1 <= 10 * 10000) {
  1359. priceLevel = 2;
  1360. $(".priceIcon").addClass("full");
  1361. if ($(".priceIcon").eq(2).hasClass("full")) {
  1362. $(".priceIcon").eq(2).removeClass("full");
  1363. }
  1364. if ($(".priceIcon").eq(3).hasClass("full")) {
  1365. $(".priceIcon").eq(3).removeClass("full");
  1366. }
  1367. if ($(".priceIcon").eq(4).hasClass("full")) {
  1368. $(".priceIcon").eq(4).removeClass("full");
  1369. }
  1370. }
  1371. if (price * 1 > 10 * 10000 && price * 1 <= 25 * 10000) {
  1372. priceLevel = 3;
  1373. $(".priceIcon").addClass("full");
  1374. if ($(".priceIcon").eq(3).hasClass("full")) {
  1375. $(".priceIcon").eq(3).removeClass("full");
  1376. }
  1377. if ($(".priceIcon").eq(4).hasClass("full")) {
  1378. $(".priceIcon").eq(4).removeClass("full");
  1379. }
  1380. }
  1381. if (price * 1 > 25 * 10000 && price * 1 <= 50 * 10000) {
  1382. priceLevel = 4;
  1383. $(".priceIcon").addClass("full");
  1384. if ($(".priceIcon").eq(4).hasClass("full")) {
  1385. $(".priceIcon").eq(4).removeClass("full");
  1386. }
  1387. }
  1388. if (price * 1 > 50 * 10000) {
  1389. priceLevel = 5;
  1390. $(".priceIcon").addClass("full");
  1391. }
  1392. }
  1393. // 检查阶梯数量
  1394. // function checkBuyNum(input, index) {
  1395. // if (index > 0) {
  1396. // var beforeNum = $('input[name="ladderPriceList[' + (index - 1) + '].buyNum"]').val() * 1;
  1397. // if (input.value * 1 <= beforeNum) {
  1398. // alertx("请输入大于上一阶起订量的值");
  1399. // $(input).val(input.value * 1 + beforeNum);
  1400. // }
  1401. // } else {
  1402. // var minNum = $('input[name="ladderPriceList[0].buyNum"]').val() * 1;
  1403. // $('#minBuyNumber').val(minNum);
  1404. // }
  1405. // }
  1406. // 检查阶梯价格
  1407. // function checkBuyPrice(input, index) {
  1408. // if (index > 0) {
  1409. // var beforePrice = $('input[name="ladderPriceList[' + (index - 1) + '].buyPrice"]').val() * 1;
  1410. // if (input.value * 1 > beforePrice) {
  1411. // $(input).val('');
  1412. // alertx("请输入小于前一个价格的值");
  1413. // }
  1414. // } else {
  1415. // var price = $('#price').val();
  1416. // if (input.value * 1 > price) {
  1417. // $(input).val('');
  1418. // alertx("第一个阶梯价格不能大于机构价");
  1419. // }
  1420. // }
  1421. // }
  1422. // 是否使用阶梯价格
  1423. function changeLadderPrice() {
  1424. var ladderPriceFlag = $("input[name='ladderPriceFlag']:checked").val();
  1425. var svipFlag = ${product.svipFlag};
  1426. if (svipFlag == 1) {
  1427. alertx("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
  1428. $("input[name='ladderPriceFlag']").get(0).checked = true;
  1429. } else {
  1430. if (ladderPriceFlag * 1 > 0) {
  1431. $("#ladderPriceBox").show();
  1432. $("#priceMinNumber").hide();
  1433. $("#delFlag1").val("0");
  1434. $('input[name="ladderPriceList[0].buyNum"]').val($('#minBuyNumber').val() * 1);
  1435. } else {
  1436. $("#ladderPriceBox").hide();
  1437. $("#priceMinNumber").show();
  1438. }
  1439. }
  1440. }
  1441. // 是否固定成本
  1442. // function changeCostPriceShow() {
  1443. // var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  1444. // if (costCheckFlag * 1 === 1) {
  1445. // $("#costPriceShow").show();
  1446. // $("#costPropShow").hide();
  1447. // } else {
  1448. // $("#costPriceShow").hide();
  1449. // $("#costPropShow").show();
  1450. // }
  1451. // }
  1452. // 全部区域
  1453. function changeAreaFlag() {
  1454. var areaFlag = $("input[name='allAreaFlag']:checked").val();
  1455. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1456. }
  1457. // 网站分类
  1458. var currentBigtype = ${product.bigTypeID};
  1459. var currentSmalltype = ${product.smallTypeID};
  1460. var currentTinytype = ${product.tinyTypeID};
  1461. var currentCommodityType = ${product.commodityType}; //商品属性
  1462. var bigTypeList = [
  1463. <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
  1464. <c:if test="${index.index > 0}">, </c:if>
  1465. {
  1466. bigTypeID: ${bigType.bigTypeID},
  1467. name: "${bigType.name}",
  1468. typeSort: ${bigType.typeSort}
  1469. }
  1470. </c:forEach>
  1471. ];
  1472. var smalltypeList = [
  1473. <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
  1474. <c:if test="${index.index > 0}">, </c:if>
  1475. {
  1476. smallTypeID: ${smalltype.smallTypeID},
  1477. name: "${smalltype.name}",
  1478. bigTypeID: ${smalltype.bigTypeID},
  1479. }
  1480. </c:forEach>
  1481. ];
  1482. var tinytypeList = [
  1483. <c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
  1484. <c:if test="${index.index > 0}">, </c:if>
  1485. {
  1486. tinyTypeID: ${tinytype.tinyTypeID},
  1487. name: "${tinytype.name}",
  1488. smallTypeID: ${tinytype.smallTypeID}
  1489. }
  1490. </c:forEach>
  1491. ];
  1492. // 初始分类
  1493. function loadInitType() {
  1494. if (currentCommodityType == null || typeof (currentCommodityType) == "undefined" || currentCommodityType == '0') {
  1495. $("#bigType").html("");
  1496. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1497. $("#bigType").append("<option value=''>请选择</option>");
  1498. $("#smallType").html("");
  1499. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1500. $("#smallType").append("<option value=''>请选择</option>");
  1501. $("#tinyType").html("");
  1502. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1503. $("#tinyType").append("<option value=''>请选择</option>");
  1504. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1505. } else if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
  1506. setTimeout(function () {
  1507. loadBigType();
  1508. }, 0);
  1509. }
  1510. }
  1511. // 分类联动
  1512. function loadBigType() {
  1513. var commodityType = $("input[name='commodityType']:checked").val();
  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. if (typeof (commodityType) != "undefined") {
  1524. $("#bigType").html("");
  1525. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1526. $("#bigType").append("<option value=''>请选择</option>");
  1527. $("#smallType").html("");
  1528. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1529. $("#smallType").append("<option value=''>请选择</option>");
  1530. $("#tinyType").html("");
  1531. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1532. $("#tinyType").append("<option value=''>请选择</option>");
  1533. for (var i = 0; i < bigTypeList.length; i++) {
  1534. if (commodityType == bigTypeList[i].typeSort) {
  1535. if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeID) {
  1536. $("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1537. $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
  1538. setTimeout(function () {
  1539. loadSmallType();
  1540. }, 500);
  1541. } else {
  1542. $("#bigType").append("<option value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1543. }
  1544. }
  1545. }
  1546. }
  1547. loadSmallType();
  1548. trainingShow();
  1549. }
  1550. function loadSmallType(id) {
  1551. if (id) {
  1552. $("#bigType").val(id);
  1553. $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
  1554. }
  1555. var bigType = $("#bigType").val();
  1556. $("#smallType").html("");
  1557. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1558. $("#smallType").append("<option value=''>请选择</option>");
  1559. $("#tinyType").html("");
  1560. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1561. $("#tinyType").append("<option value=''>请选择</option>");
  1562. if (typeof (bigType) != "undefined" && bigType != "") {
  1563. var smallTypeNum = 0;
  1564. for (var i = 0; i < smalltypeList.length; i++) {
  1565. if (bigType == smalltypeList[i].bigTypeID) {
  1566. smallTypeNum = smallTypeNum + 1;
  1567. if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
  1568. $("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1569. $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
  1570. setTimeout(function () {
  1571. loadTinyType(currentSmalltype);
  1572. }, 500);
  1573. } else {
  1574. $("#smallType").append("<option value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1575. }
  1576. }
  1577. }
  1578. if (smallTypeNum == 0) {
  1579. $("#smallType").removeClass("required");
  1580. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1581. } else {
  1582. $("#smallType").addClass("required");
  1583. document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
  1584. }
  1585. } else {
  1586. $("#smallType").removeClass("required");
  1587. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1588. }
  1589. loadTinyType();
  1590. }
  1591. function loadTinyType(id) {
  1592. if (id) {
  1593. $("#smallType").val(id);
  1594. $("#smallType").prev().find(".select2-chosen").text($("#smallType option:selected").text());
  1595. }
  1596. var smallType = $("#smallType option:selected").val();
  1597. $("#tinyType").html("");
  1598. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1599. $("#tinyType").append("<option value=''>请选择</option>");
  1600. if (typeof (smallType) != "undefined" && smallType != "") {
  1601. var tinyTypeNum = 0;
  1602. for (var i = 0; i < tinytypeList.length; i++) {
  1603. if (smallType == tinytypeList[i].smallTypeID) {
  1604. tinyTypeNum = tinyTypeNum + 1;
  1605. if (currentTinytype != null && typeof (currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
  1606. $("#tinyType").append("<option selected value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1607. $("#tinyType").prev().find(".select2-chosen").text(tinytypeList[i].name);
  1608. } else {
  1609. $("#tinyType").append("<option value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1610. }
  1611. }
  1612. }
  1613. if (tinyTypeNum == 0) {
  1614. $("#tinyType").removeClass("required");
  1615. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1616. } else {
  1617. $("#tinyType").addClass("required");
  1618. document.getElementById("s2id_tinyType").style.cssText = "display: inline-block";
  1619. }
  1620. } else {
  1621. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1622. $("#tinyType").removeClass("required");
  1623. }
  1624. }
  1625. //验证字符串最大长度
  1626. function checkmaxlength(str) {
  1627. var realLength = 0;
  1628. for (var i = 0; i < str.length; i++) {
  1629. charCode = str.charCodeAt(i);
  1630. if (charCode >= 0 && charCode <= 128)
  1631. realLength += 1;
  1632. else
  1633. realLength += 2;
  1634. }
  1635. if (realLength > 100) {
  1636. alertx("商品名称最多50个汉字,即100个字符!当前输入长度为" + realLength);
  1637. }
  1638. }
  1639. //验证字符串最大长度
  1640. function checkmaxlengths(str, maxlength) {
  1641. var realLength = 0;
  1642. for (var i = 0; i < str.length; i++) {
  1643. charCode = str.charCodeAt(i);
  1644. if (charCode >= 0 && charCode <= 128)
  1645. realLength += 1;
  1646. else
  1647. realLength += 2;
  1648. }
  1649. if (realLength > maxlength) {
  1650. alertx("商品名称最多30个汉字,即60个字符!当前输入长度为" + realLength);
  1651. }
  1652. }
  1653. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  1654. var realLength = 0;
  1655. var maxChange = "1";
  1656. for (var i = 0; i < str.length; i++) {
  1657. charCode = str.charCodeAt(i);
  1658. if (charCode >= 0 && charCode <= 128)
  1659. realLength += 1;
  1660. else {
  1661. realLength += 2;
  1662. maxChange = "2";
  1663. }
  1664. }
  1665. if (maxChange == "2") {
  1666. var s = str.substr(0, 16);
  1667. $(searckThis).val(s);
  1668. }
  1669. if (realLength > maxlength) {
  1670. alertx("关键字最多16个汉字,即32个字符!");
  1671. }
  1672. }
  1673. function checkPrecisehKeyLength(str) {
  1674. var realLength = 0;
  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. }
  1682. if (realLength > 160) {
  1683. alertx("精确关键词最多80个汉字,即160个字符!当前输入长度为" + realLength);
  1684. }
  1685. }
  1686. var skuIndex = 0;
  1687. var productJson = ${productJson};
  1688. console.log(productJson);
  1689. var skuList = productJson.skuList;
  1690. $(".addSku").click(function () {
  1691. var skuTemplate = $('#skuTemplate').html()
  1692. $("#skus").append(skuTemplate).show();
  1693. var current = $("#skus").find('.sku').eq(-1);
  1694. var product = {
  1695. skuIndex: ++skuIndex,
  1696. costCheckFlag: '1',
  1697. ladderPriceFlag: '0'
  1698. }
  1699. setSkuPrototypeValues(current, product);
  1700. skuEventBind(current, product);
  1701. })
  1702. function deleteDiv(el){
  1703. el.parentNode.parentNode.parentNode.parentNode.removeChild(el.parentNode.parentNode.parentNode);
  1704. }
  1705. function insertDefaultSkuRow() {
  1706. console.log('skuList', skuList);
  1707. if (skuList) {
  1708. for (var i = 0; i < skuList.length; i++) {
  1709. var skuTemplate = $('#skuTemplate').html();
  1710. $("#skus").append(skuTemplate).show();
  1711. var current = $("#skus").find('.sku').eq(-1);
  1712. var product = skuList[i];
  1713. product.skuIndex = i;
  1714. setSkuPrototypeValues(current, product);
  1715. skuEventBind(current, product);
  1716. skuIndex = i
  1717. }
  1718. }
  1719. // else {
  1720. // var product = {};
  1721. // product.skuIndex = 0;
  1722. // setSkuPrototypeValues(current, product);
  1723. // skuEventBind(current, product);
  1724. // }
  1725. }
  1726. /* 设置新增sku属性值 */
  1727. function setSkuPrototypeValues(el, product) {
  1728. console.log(product);
  1729. if (!product) return;
  1730. var skuIndex = product.skuIndex;
  1731. var index = el.find('input[name$="index"]');
  1732. index.val(skuIndex);
  1733. if(product.skuId){
  1734. var skuId=el.find('input[name$="skuId"]');
  1735. skuId.val(product.skuId);
  1736. skuId.attr('name', 'skuList[' + skuIndex + '].skuId');
  1737. }
  1738. // 包装规格
  1739. var unit = el.find('input[name$="unit"]');
  1740. unit.val(product.unit)
  1741. unit.attr('name', 'skuList[' + skuIndex + '].unit');
  1742. // 市场价
  1743. var normalPrice = el.find('input[name$="normalPrice"]');
  1744. normalPrice.val(product.normalPrice)
  1745. normalPrice.attr('name', 'skuList[' + skuIndex + '].normalPrice');
  1746. // 库存
  1747. var stock = el.find('input[name$="stock"]');
  1748. stock.val(product.stock)
  1749. stock.attr('name', 'skuList[' + skuIndex + '].stock');
  1750. // 成本
  1751. var costCheckFlag = el.find('input[name$="costCheckFlag"]');
  1752. costCheckFlag.attr('name', 'skuList[' + skuIndex + '].costCheckFlag');
  1753. costCheckFlag.eq(0).attr('checked', product.costCheckFlag == 1);
  1754. costCheckFlag.eq(1).attr('checked', product.costCheckFlag != 1);
  1755. // 成本价
  1756. var costPrice = el.find('input[name$="costPrice"]');
  1757. costPrice.val(product.costPrice)
  1758. costPrice.attr('name', 'skuList[' + skuIndex + '].costPrice');
  1759. // 比例成本百分比
  1760. var costProportional = el.find('input[name$="costProportional"]');
  1761. costProportional.val(product.costProportional)
  1762. costProportional.attr('name', 'skuList[' + skuIndex + '].costProportional');
  1763. if (product.costCheckFlag != 1) {
  1764. costProportional.parent('.sku-costProportional').show();
  1765. costPrice.parent('.sku-costPrice').hide();
  1766. } else {
  1767. costPrice.parent('.sku-costPrice').show();
  1768. costProportional.parent('.sku-costProportional').hide();
  1769. }
  1770. // 机构价
  1771. var price = el.find('input[name$="price"]');
  1772. price.val(product.price)
  1773. price.attr('name', 'skuList[' + skuIndex + '].price');
  1774. // 商品展示阶梯价格
  1775. var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
  1776. // 起订量
  1777. var ladderPriceBox = el.find('.ladderPriceBox');
  1778. ladderPriceFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceFlag');
  1779. ladderPriceFlag.eq(0).attr('checked', product.ladderPriceFlag != 1);
  1780. ladderPriceFlag.eq(1).attr('checked', product.ladderPriceFlag == 1);
  1781. // 起订量
  1782. var minBuyNumber = el.find('input[name$="minBuyNumber"]');
  1783. minBuyNumber.val(product.minBuyNumber)
  1784. minBuyNumber.attr('name', 'skuList[' + skuIndex + '].minBuyNumber');
  1785. if (product.ladderPriceFlag == 1) {
  1786. ladderPriceBox.show();
  1787. minBuyNumber.parent('.sku-minBuyNumber').hide();
  1788. }
  1789. ladderPriceBox.find('.ladderPrice').each(function (index, item) {
  1790. var ladderPrice = {}
  1791. if (product.ladderPriceList && product.ladderPriceList.length > 0) {
  1792. ladderPrice = product.ladderPriceList[index] || {};
  1793. }
  1794. console.log('ladderPrice---', ladderPrice)
  1795. // 起订量
  1796. var buyNum = $(item).find('[name$="buyNum"]');
  1797. buyNum.val(ladderPrice.buyNum);
  1798. buyNum.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyNum');
  1799. // 价格
  1800. var buyPrice = $(item).find('[name$="buyPrice"]');
  1801. buyPrice.val(ladderPrice.buyPrice);
  1802. buyPrice.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyPrice');
  1803. // 阶梯价id
  1804. var id = $(item).find('[name$="id"]');
  1805. id.val(ladderPrice.id);
  1806. id.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].id');
  1807. // 阶梯价delFlag
  1808. var delFlag = $(item).find('[name$="delFlag"]');
  1809. delFlag.val(ladderPrice.delFlag || 1);
  1810. delFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].delFlag');
  1811. });
  1812. skuIndex++;
  1813. }
  1814. function skuEventBind(el, product) {
  1815. var i = product.skuIndex;
  1816. // 商品展示阶梯价格
  1817. var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
  1818. // 起订量
  1819. var ladderPriceBox = el.find('.ladderPriceBox');
  1820. var minBuyNumber = el.find('input[name$="minBuyNumber"]');
  1821. // 成本价 or 百分比
  1822. var costCheckFlag = el.find('input[name$="costCheckFlag"]');
  1823. var costPrice = el.find('input[name$="costPrice"]');
  1824. var costProportional = el.find('input[name$="costProportional"]');
  1825. // 机构价
  1826. var clubPrice = el.find('input[name$="skuList[' + i + '].price"]');
  1827. //阶梯价格
  1828. var ladderPrice = el.find('input[name$="skuList[' + i + '].ladderPriceList[0].buyPrice"]');
  1829. var ladderPrice2 = el.find('input[name$="skuList[' + i + '].ladderPriceList[1].buyPrice"]');
  1830. var ladderPrice3 = el.find('input[name$="skuList[' + i + '].ladderPriceList[2].buyPrice"]');
  1831. //起订量
  1832. var num = el.find('input[name$="skuList[' + i + '].ladderPriceList[0].buyNum"]');
  1833. var num2 = el.find('input[name$="skuList[' + i + '].ladderPriceList[1].buyNum"]');
  1834. var num3 = el.find('input[name$="skuList[' + i + '].ladderPriceList[2].buyNum"]');
  1835. num2.on('change', function () {
  1836. var buyNum = num.val() * 1;
  1837. var buyNum2 = num2.val() * 1;
  1838. if (buyNum2 <= buyNum) {
  1839. alertx('请输入大于上一阶起订量的值');
  1840. num2.val('');
  1841. }
  1842. })
  1843. num3.on('change', function () {
  1844. var buyNum2 = num2.val() * 1;
  1845. var buyNum3 = num3.val() * 1;
  1846. if (buyNum3 <= buyNum2) {
  1847. alertx('请输入大于上一阶起订量的值');
  1848. num3.val('');
  1849. }
  1850. })
  1851. ladderPrice.on('change', function () {
  1852. var ldp = ladderPrice.val() * 1;
  1853. var price = clubPrice.val() * 1;
  1854. if (ldp >= price) {
  1855. alertx('第一个阶梯价格不能大于机构价');
  1856. ladderPrice.val('');
  1857. }
  1858. })
  1859. ladderPrice2.on('change', function () {
  1860. var ldp2 = ladderPrice2.val() * 1;
  1861. var ldp = ladderPrice.val() * 1;
  1862. if (ldp2 >= ldp) {
  1863. alertx('第二个阶梯价格不能大于第一个阶梯价格');
  1864. ladderPrice2.val('');
  1865. }
  1866. })
  1867. ladderPrice3.on('change', function () {
  1868. var ldp2 = ladderPrice2.val() * 1;
  1869. var ldp3 = ladderPrice3.val() * 1;
  1870. if (ldp3 >= ldp2) {
  1871. alertx('第三个阶梯价格不能大于第二个阶梯价格');
  1872. ladderPrice3.val('');
  1873. }
  1874. })
  1875. ladderPriceFlag.on('change', function () {
  1876. if (product && product.svipFlag == 1 && $(this).val() == 1) {
  1877. alert("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
  1878. ladderPriceFlag.eq(0).attr('checked', true);
  1879. ladderPriceFlag.eq(1).attr('checked', false);
  1880. ladderPriceFlag.eq(1).attr('disabled', true);
  1881. return;
  1882. }
  1883. if ($(this).val() == 1) {
  1884. ladderPriceBox.show();
  1885. minBuyNumber.parent('.sku-minBuyNumber').hide();
  1886. el.find('input[name$="skuList[' + i + '].ladderPriceList[0].delFlag"]').val(0);
  1887. } else {
  1888. ladderPriceBox.hide();
  1889. minBuyNumber.parent('.sku-minBuyNumber').show();
  1890. }
  1891. })
  1892. ladderPriceBox.find('.addBtn').on('click', function () {
  1893. $(this).hide();
  1894. $(this).parent('.ladderPrice').find('.delBtn').hide();
  1895. $(this).parent('.ladderPrice').next().show();
  1896. $(this).parent('.ladderPrice').next().find('.delBtn').show();
  1897. $(this).parent('.ladderPrice').next().find('.delFlag').val(0);
  1898. })
  1899. ladderPriceBox.find('.delBtn').on('click', function () {
  1900. $(this).hide();
  1901. $(this).parent('.ladderPrice').hide();
  1902. $(this).parent('.ladderPrice').find('.delFlag').val(1);
  1903. $(this).parent('.ladderPrice').prev().find('.addBtn').show();
  1904. $(this).parent('.ladderPrice').prev().find('.delBtn').show();
  1905. })
  1906. if(product.ladderPriceFlag == 1){
  1907. ladderPriceBox.find('.ladderPrice').each(function (index, item) {
  1908. var ladderPrice = product.ladderPriceList[index]
  1909. var delFlag = 1
  1910. if (ladderPrice) {
  1911. delFlag = ladderPrice.delFlag
  1912. }
  1913. console.log(delFlag)
  1914. if (index != 0) {
  1915. $(item).hide();
  1916. }
  1917. if (delFlag == 0 && product.ladderPriceFlag == 1) {
  1918. $(item).show()
  1919. }
  1920. })
  1921. }
  1922. costCheckFlag.on('change', function () {
  1923. if ($(this).val() == 1) {
  1924. costProportional.parent('.sku-costProportional').hide();
  1925. costPrice.parent('.sku-costPrice').show();
  1926. } else {
  1927. costProportional.parent('.sku-costProportional').show();
  1928. costPrice.parent('.sku-costPrice').hide();
  1929. }
  1930. })
  1931. }
  1932. // 添加相关参数
  1933. var productParametersIndex = $('#productParametersLength').val() - 1;
  1934. $(".addParams").click(function () {
  1935. var val = $("#paramsName").val();
  1936. // alertx("+++++"+val.length)
  1937. productParametersIndex++;
  1938. var html = '<div id="paramsItem" class="paramsItem">';
  1939. html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsName" id="paramsName" style="width:142px" maxlength="10" placeholder="参数名称" type="text" class="input-small"/>&nbsp;';
  1940. html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsContent" id="paramsContent" style="width:680px" maxlength="50" placeholder="请输入参数信息" type="text" class="input-small"/>&nbsp;';
  1941. html += '<span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)"">删除</span>';
  1942. html += '</div>';
  1943. $("#addParamsItems").append(html).show();
  1944. var paramsItemLength = $('.paramsItem').length;
  1945. if (paramsItemLength === 50) {
  1946. $(this).hide();
  1947. return
  1948. }
  1949. });
  1950. //添加标签
  1951. $(".addTags").click(function () {
  1952. // 获取输入新标签
  1953. var val = $("#inputTags").val();
  1954. // 清空输入框输入
  1955. $("#inputTags").val("");
  1956. if (null === val || "" === val) {
  1957. alertx("请输入商品标签");
  1958. return;
  1959. }
  1960. // 添加新标签
  1961. $("#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();
  1962. var tagsLength = $('.tags-li').length;
  1963. if (tagsLength === 6) {
  1964. $(this).hide();
  1965. return
  1966. }
  1967. });
  1968. /**
  1969. * 删除对于标签
  1970. */
  1971. function removerX(ithis) {
  1972. $(ithis).parent().remove();
  1973. var tagsLength = $('.tags-li').length;
  1974. if (tagsLength < 6) {
  1975. $('.addTags').show();
  1976. }
  1977. }
  1978. //初始化商品类型
  1979. $(function () {
  1980. changeMachine();
  1981. })
  1982. function changeMachine() {
  1983. var val = $("#productType").val();
  1984. // 0其它,1妆字号,2械字号
  1985. if (val == 1 || val == 0) {
  1986. //隐藏械字号
  1987. $(".machineType").hide();
  1988. } else if (val == 2) {
  1989. // 显示械字号
  1990. $(".machineType").show();
  1991. }
  1992. }
  1993. //初始化含税信息
  1994. $(function () {
  1995. var includedTax = $("input[name='includedTax']:checked").val();
  1996. var invoiceType = $("input[name='invoiceType']:checked").val();
  1997. var taxPoint = $("#taxPoint").val();
  1998. //1含税,0不含税
  1999. if (includedTax == 1) {
  2000. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
  2001. $("#taxPointDiv").show();
  2002. $("#supplierTaxPointDiv").show();
  2003. }
  2004. if (includedTax == 0) {
  2005. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
  2006. // 选择增值税且不为不开发票
  2007. if (invoiceType == 3) {
  2008. $("#taxPointDiv").hide();
  2009. $("#supplierTaxPointDiv").hide();
  2010. } else {
  2011. $("#taxPointDiv").show();
  2012. $("#supplierTaxPointDiv").show();
  2013. }
  2014. }
  2015. if (includedTax == 2) {
  2016. $("#invoiceItem").hide();
  2017. $("#taxPointDiv").hide();
  2018. $("#supplierTaxPointDiv").hide();
  2019. }
  2020. if (includedTax == "" || includedTax == null) {
  2021. $("#invoiceItem").hide();
  2022. $("#taxPointDiv").hide();
  2023. $("#supplierTaxPointDiv").hide();
  2024. }
  2025. //发票初始化
  2026. if (includedTax == 0 && (invoiceType == 1 || invoiceType == 2)) {
  2027. $("#taxPointDiv").show();
  2028. $("#supplierTaxPointDiv").show();
  2029. }
  2030. if (includedTax == 1) {//含税
  2031. // 一个都没选中默认选中增值税
  2032. if (invoiceType != 1 && invoiceType != 2) {
  2033. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2034. }
  2035. } else if (includedTax == 0) {//不含税
  2036. // 一个都没选中默认选中增值税
  2037. if (invoiceType != 1 && invoiceType != 2 && invoiceType != 3) {
  2038. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2039. }
  2040. if (invoiceType == 1) {//增值税
  2041. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2042. if (taxPoint == null || taxPoint == "") {
  2043. $("#taxPoint").val(13);
  2044. }
  2045. } else if (invoiceType == 2) {//普通发票
  2046. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2047. if (taxPoint == null || taxPoint == "") {
  2048. $("#taxPoint").val(6);
  2049. }
  2050. }
  2051. }
  2052. });
  2053. /**
  2054. * @param obj
  2055. * jquery控制input只能输入数字
  2056. */
  2057. function onlynum(obj) {
  2058. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  2059. }
  2060. function chageIncludedTax(taxPointValue) {
  2061. //修改选择项
  2062. var includedTax = $("input[name='includedTax']:checked").val();
  2063. var invoiceType = $("input[name='invoiceType']:checked").val();
  2064. var taxPoint = taxPointValue;
  2065. //1含税,0不含税,2未知
  2066. if (includedTax == 1) {
  2067. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
  2068. $("#taxPointDiv").show();
  2069. $("#supplierTaxPointDiv").show();
  2070. }
  2071. if (includedTax == 0) {
  2072. $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
  2073. // 选择增值税且不为不开发票
  2074. if (invoiceType == 3) {
  2075. $("#taxPointDiv").hide();
  2076. $("#supplierTaxPointDiv").hide();
  2077. } else {
  2078. $("#taxPointDiv").show();
  2079. $("#supplierTaxPointDiv").show();
  2080. }
  2081. }
  2082. if (includedTax == 2) {
  2083. $("#invoiceItem").hide();
  2084. $("#taxPointDiv").hide();
  2085. $("#supplierTaxPointDiv").hide();
  2086. }
  2087. if (includedTax == "" || includedTax == null) {
  2088. $("#invoiceItem").hide();
  2089. $("#taxPointDiv").hide();
  2090. $("#supplierTaxPointDiv").hide();
  2091. }
  2092. if (includedTax == 1) {//含税
  2093. // 一个都没选中默认选中增值税
  2094. if (invoiceType != 1 && invoiceType != 2) {
  2095. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2096. }
  2097. } else if (includedTax == 0) {//不含税
  2098. // 一个都没选中默认选中增值税
  2099. if (invoiceType != 1 && invoiceType != 2 && invoiceType != 3) {
  2100. $("input[name='invoiceType']:eq(0)").attr("checked", 'checked');
  2101. }
  2102. }
  2103. invoiceType = $("input[name='invoiceType']:checked").val();
  2104. if (invoiceType == 1) {//增值税
  2105. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2106. if (taxPoint == null || taxPoint == "") {
  2107. $("#taxPoint").val(13);
  2108. $("#supplierTaxPoint").val(13);
  2109. }
  2110. } else if (invoiceType == 2) {//普通发票
  2111. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2112. if (taxPoint == null || taxPoint == "") {
  2113. $("#taxPoint").val(6);
  2114. $("#supplierTaxPoint").val(6);
  2115. }
  2116. }
  2117. }
  2118. //选择发票类型
  2119. function changeInvoiceType(taxPointValue) {
  2120. var taxPoint = taxPointValue;
  2121. var includedTax = $("input[name='includedTax']:checked").val();
  2122. //选择发票类型:1增值税票,2普通票, 3不能开票
  2123. var invoiceType = $("input[name='invoiceType']:checked").val();
  2124. //只有在选择了不含税才使用税点,不含税里面的
  2125. if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
  2126. $("#taxPointDiv").show();
  2127. $("#supplierTaxPointDiv").show();
  2128. } else {
  2129. $("#taxPointDiv").hide();
  2130. $("#supplierTaxPointDiv").hide();
  2131. }
  2132. if (invoiceType == 1) {//增值税
  2133. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2134. if (taxPoint == null || taxPoint == "") {
  2135. $("#taxPoint").val(13);
  2136. $("#supplierTaxPoint").val(13);
  2137. }
  2138. } else if (invoiceType == 2) {//普通发票
  2139. // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
  2140. if (taxPoint == null || taxPoint == "") {
  2141. $("#taxPoint").val(6);
  2142. $("#supplierTaxPoint").val(6);
  2143. }
  2144. }
  2145. }
  2146. //删除相关参数
  2147. function deleteParams(paramsThis) {
  2148. $(paramsThis).parent().remove();
  2149. var paramsItemLength = $('.paramsItem').length;
  2150. if (paramsItemLength < 50) {
  2151. $('.addParams').show();
  2152. }
  2153. }
  2154. //限制两位小数
  2155. function setTwoNumberDecimal(that) {
  2156. var n = parseFloat(that.value);
  2157. that.value = n.toFixed(2)
  2158. }
  2159. //培训相关显示
  2160. function trainingShow() {
  2161. var commodityType = $("input[name='commodityType']:checked").val();
  2162. var trainingType = $("input[name='trainingType']:checked").val();
  2163. if (commodityType == 2) {
  2164. $(".training").show();
  2165. if (trainingType == 1) {
  2166. $("#trainingFee").show();
  2167. } else {
  2168. $("#trainingFee").hide();
  2169. }
  2170. } else {
  2171. $(".training").hide();
  2172. $("#trainingFee").hide();
  2173. }
  2174. }
  2175. </script>
  2176. </body>
  2177. </html>