productEdit.jsp 79 KB

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