productEdit.jsp 105 KB

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