productEdit.jsp 105 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446
  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}"
  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>&nbsp;&nbsp;&nbsp;&nbsp;
  313. <c:if test="${!empty product.keywords}">
  314. <span style="display: inline-block; width: 120px">供应商关联标签:(${product.shopName})</span>
  315. <span><textarea rows="5" style="width: 750px;">${product.keywords}</textarea></span>
  316. </c:if>
  317. </td>
  318. </tr>
  319. <tr>
  320. <th>相关参数:</th>
  321. <td colspan="3" class="params">
  322. <div id="addParamsItems">
  323. <%--相关参数层--%>
  324. <input type="hidden" value="${fn:length(product.productParametersList)}"
  325. id="productParametersLength">
  326. <c:forEach items="${product.productParametersList}" var="item" varStatus="varIndex">
  327. <div id="paramsItem" class="paramsItem">
  328. <form:input path="productParametersList[${varIndex.index}].paramsName" id="paramsName"
  329. cssStyle="width:142px" maxlength="10" placeholder="参数名称" class="input-small"/>
  330. <form:input path="productParametersList[${varIndex.index}].paramsContent" id="paramsContent"
  331. cssStyle="width:680px" maxlength="50" placeholder="请输入参数信息"
  332. class="input-small"/>
  333. <span type="button" style="cursor: pointer;color: #0B61A4"
  334. onclick="deleteParams(this)">删除</span>
  335. </div>
  336. </c:forEach>
  337. </div>
  338. <button class="addParams" onclick="return false">添加参数</button>
  339. </td>
  340. </tr>
  341. <tr>
  342. <th>品牌:</th>
  343. <td colspan="3">
  344. <form:select path="brandID" class="input-small">
  345. <form:option value="" label="请选择"/>
  346. <form:options items="${brandList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
  347. </form:select>
  348. </td>
  349. </tr>
  350. <c:if test="${product.shopType == 2}">
  351. <tr>
  352. <th><span style="color: red">*</span>供应商:</th>
  353. <td colspan="3">
  354. <form:select path="shopID" class="input-small required" onchange="getCodes(this.value)">
  355. <form:option value="" label="请选择"/>
  356. <c:forEach items="${shopList}" var="shop" varStatus="index">
  357. <form:option value="${shop.shopID}" label="${shop.name}"/>
  358. </c:forEach>
  359. </form:select>
  360. </td>
  361. </tr>
  362. <tr>
  363. <th>商品图片:</th>
  364. <td>
  365. <div class="controls upload-content" id="secondHandImage" style="width: 800px;">
  366. <div class="conList">
  367. <form:hidden value="${product.image1}" id="image1" path="image1" htmlEscape="false"
  368. maxlength="255" class="input-xlarge required"/>
  369. <sys:ckfinder input="image1" type="images" uploadPath="/photo" selectMultiple="false"
  370. maxWidth="100"
  371. maxHeight="100"/>
  372. </div>
  373. <div class="conList hide-pic">
  374. <form:hidden value="${product.image2}" id="image2" path="image2" htmlEscape="false"
  375. maxlength="255" class="input-xlarge"/>
  376. <sys:ckfinder input="image2" type="images" uploadPath="/photo" selectMultiple="false"
  377. maxWidth="100"
  378. maxHeight="100"/>
  379. </div>
  380. <div class="conList hide-pic">
  381. <form:hidden value="${product.image3}" id="image3" path="image3" htmlEscape="false"
  382. maxlength="255" class="input-xlarge"/>
  383. <sys:ckfinder input="image3" type="images" uploadPath="/photo" selectMultiple="false"
  384. maxWidth="100"
  385. maxHeight="100"/>
  386. </div>
  387. <div class="conList hide-pic">
  388. <form:hidden value="${product.image4}" id="image4" path="image4" htmlEscape="false"
  389. maxlength="255" class="input-xlarge"/>
  390. <sys:ckfinder input="image4" type="images" uploadPath="/photo" selectMultiple="false"
  391. maxWidth="100"
  392. maxHeight="100"/>
  393. </div>
  394. <div class="conList hide-pic">
  395. <form:hidden value="${product.image5}" id="image5" path="image5" htmlEscape="false"
  396. maxlength="255" class="input-xlarge"/>
  397. <sys:ckfinder input="image5" type="images" uploadPath="/photo" selectMultiple="false"
  398. maxWidth="100"
  399. maxHeight="100"/>
  400. </div>
  401. </div>
  402. <div class="conList upload-tips" style="margin-top: 20px;">
  403. <font color="red">第一张图作为商品主图必传;最多上传5张商品图片,请尽量全部上传,单张图片不能超过5M</font>
  404. </div>
  405. </td>
  406. </tr>
  407. </c:if>
  408. <tr>
  409. <th>组合名称:</th>
  410. <td colspan="3">
  411. <form:select path="combinationID" class="input-small">
  412. <form:option value="" label="请选择"/>
  413. <form:options items="${combinationList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
  414. </form:select>
  415. </td>
  416. </tr>
  417. <tr>
  418. <th><span class="red">*</span>商品标签:</th>
  419. <td colspan="3">
  420. <input id="inputTags" maxlength="15" style="width:217px;border-radius:5px" placeholder="请输入商品标签"
  421. class="input-small"/>
  422. <button class="addTags" onclick="return false">添加标签</button>
  423. <p style="margin-top: 5px">简述商品功效和特性,最多可添加6个标签,每个标签字数不超过15个汉字(如:美白祛斑,消除皱纹)</p>
  424. <div id="tagsList">
  425. <input type="hidden" name="tagsLists" value="${product.tags}" id="tagsLists">
  426. <%--标签--%>
  427. </div>
  428. </td>
  429. </tr>
  430. <tr>
  431. <th><span class="red">*</span>商品属性:</th>
  432. <td colspan="3">
  433. <label><input type="radio" name="commodityType" value="1"
  434. onchange="loadBigType()" ${product.commodityType == "1" ? "checked" : ""} />产品<b
  435. class="line">|</b></label>
  436. <label><input type="radio" name="commodityType" value="2"
  437. onchange="loadBigType()" ${product.commodityType == "2" ? "checked" : ""} />仪器</label>
  438. </td>
  439. </tr>
  440. <tr class="training" hidden>
  441. <th><span class="red">*</span>培训方式:</th>
  442. <td colspan="3">
  443. <label><input type="radio" name="trainingMethod"
  444. value="1" ${empty product.trainingMethod || product.trainingMethod == 1 ? "checked" : ""} />线上培训<b
  445. class="line">|</b></label>
  446. <label><input type="radio" name="trainingMethod"
  447. value="2" ${product.trainingMethod == 2 ? "checked" : ""} />线下培训</label>
  448. </td>
  449. </tr>
  450. <tr class="training" hidden>
  451. <th><span class="red">*</span>培训费用:</th>
  452. <td colspan="3">
  453. <label><input type="radio" name="trainingType"
  454. value="1" ${empty product.trainingType || product.trainingType == 1 ? "checked" : ""}
  455. onchange="trainingShow()"/>售价未包含<b class="line">|</b></label>
  456. <label><input type="radio" name="trainingType" value="2" ${product.trainingType == 2 ? "checked" : ""}
  457. onchange="trainingShow()"/>售价已包含</label>
  458. </td>
  459. </tr>
  460. <tr id="trainingFee" hidden>
  461. <th></th>
  462. <td colspan="3">
  463. <input type="number" name="trainingFee" value="${product.trainingFee}" style="width: 250px" min="0"
  464. placeholder="请填写包含食宿,交通等各项费用的总金额"/>
  465. </td>
  466. </tr>
  467. <tr>
  468. <th><span class="red">*</span>分类:</th>
  469. <td colspan="3">
  470. <form:select path="bigTypeID" class="input-small required" id="bigType" onchange="loadSmallType()">
  471. <form:option value="" label="请选择"/>
  472. <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
  473. htmlEscape="false"/>
  474. </form:select>
  475. <form:select path="smallTypeID" class="input-small" id="smallType" onchange="loadTinyType()">
  476. <form:option value="" label="请选择"/>
  477. <c:forEach items="${classify.smalltypeList}" var="smallType">
  478. <form:option value="${smallType.smallTypeID}" label="${smallType.name}"
  479. bigTypeID="${smallType.bigTypeID}"/>
  480. </c:forEach>
  481. </form:select>
  482. <form:select path="tinyTypeID" class="input-small" id="tinyType">
  483. <form:option value="" label="请选择"/>
  484. <c:forEach items="${classify.tinytypeList}" var="tinyType">
  485. <form:option value="${tinyType.tinyTypeID}" label="${tinyType.name}"
  486. bigTypeID="${tinyType.smallTypeID}"/>
  487. </c:forEach>
  488. </form:select>
  489. </td>
  490. </tr>
  491. <tr>
  492. <th><span class="red">*</span>商品类型:</th>
  493. <td colspan="3">
  494. <form:select path="productType" id="productType" onchange="js()" class="input-small required"
  495. onclick="changeMachine(this)">
  496. <form:option value="" label="请选择"/>
  497. <form:option value="1" label="妆字号"/>
  498. <form:option value="2" label="械字号"/>
  499. <form:option value="0" label="其它"/>
  500. </form:select>
  501. <span class="machineType">
  502. <form:select path="machineType" id="machineType" onchange="js()" class="input-small">
  503. <form:option value="" label="请选择"/>
  504. <form:option value="1" label="一类"/>
  505. <form:option value="2" label="二类"/>
  506. <form:option value="3" label="三类"/>
  507. </form:select>
  508. </span>
  509. </td>
  510. </tr>
  511. <tr id="xiezihao" class="machineType">
  512. <th><span class="red">*</span>资质证书:</th>
  513. <td colspan="3">
  514. <%-- 械字号医疗证书--%>
  515. <form:hidden id="qualificationImg" path="qualificationImg" htmlEscape="false" maxlength="255"
  516. class="input-xlarge"/>
  517. <sys:ckfinder input="qualificationImg" type="images" uploadPath="/photo" selectMultiple="false"
  518. maxWidth="100" maxHeight="100"/>
  519. </td>
  520. </tr>
  521. <tr class="machineType">
  522. <th><span class="red">*</span>证书编号:</th>
  523. <td colspan="1">
  524. <form:input path="qualificationNo" maxlength="50" class="input-small"/>
  525. </td>
  526. </tr>
  527. <tr class="machineType">
  528. <th><span class="red">*</span>产品名称:</th>
  529. <td colspan="2">
  530. <form:input path="productName" maxlength="80" class="input-small"/>
  531. </td>
  532. </tr>
  533. <tr class="machineType">
  534. <th><span class="red">*</span>证书有效期:</th>
  535. <td colspan="3">
  536. <%-- <form:input path="qualificationTime" type="text" maxlength="20" class="input-medium Wdate" value="${product.qualificationTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>--%>
  537. <form:input path="qualificationTime" type="text" maxlength="10" class="input-medium Wdate"
  538. value="${qualificationTime}"
  539. onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
  540. </td>
  541. </tr>
  542. <tr class="machineType">
  543. <th><span class="red">*</span>证书基本信息链接:</th>
  544. <td colspan="4">
  545. <form:input path="qualificationLink" maxlength="300"
  546. class="input-small"/>
  547. </td>
  548. </tr>
  549. <tr>
  550. <th><span class="red">*</span>SKU种类:</th>
  551. <td>
  552. <div><span><button class="addSku" onclick="return false">添加SKU</button></span></div>
  553. <%-- 插入html --%>
  554. <div id="skus"></div>
  555. </td>
  556. </tr>
  557. <tr>
  558. <th><span class="red">*</span>是否含税:</th>
  559. <td>
  560. <label><input type="radio" name="includedTax" value="1"
  561. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "1" ? "checked" : ""}>含税<b
  562. class="line">|</b></label>
  563. <label><input type="radio" name="includedTax" value="0"
  564. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "0" ? "checked" : ""}>不含税<b
  565. class="line">|</b></label>
  566. <label><input type="radio" name="includedTax" value="2"
  567. onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "2"||product.includedTax==null ? "checked" : ""}>未知</label>
  568. </td>
  569. </tr>
  570. <tr id="invoiceItem">
  571. <th></th>
  572. <td>
  573. <span class="invoice">
  574. <label><input type="radio" name="invoiceType" value="1"
  575. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "1" ? "checked" : ""}>开增值税专用发票<b
  576. class="line">|</b></label>
  577. <label><input type="radio" name="invoiceType" value="2"
  578. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "2" ? "checked" : ""}>开增值税普通发票</label>
  579. </span>
  580. <span class="notInvoice">
  581. <b class="line">|</b>
  582. <label><input type="radio" name="invoiceType" value="3"
  583. onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "3"||product.invoiceType ==null ? "checked" : ""}>不能开票</label>
  584. </span>
  585. </td>
  586. </tr>
  587. <tr>
  588. <th>线上分账账号:</th>
  589. <td colspan="3">
  590. <c:if test="${not empty product.productID}">
  591. <form:select path="splitCode" class="select-ele input-medium">
  592. <form:option value="" label="请选择"/>
  593. <c:forEach items="${splitCodeList}" var="splitCodeList" varStatus="index">
  594. <form:option value="${splitCodeList.splitCode}" label="${splitCodeList.codeRemark}"/>
  595. </c:forEach>
  596. </form:select>
  597. </c:if>
  598. <c:if test="${empty product.productID}">
  599. <form:select path="splitCode" class="select-ele input-medium" id="getCode">
  600. <form:option value="" label="请选择"/>
  601. </form:select>
  602. </c:if>
  603. </td>
  604. </tr>
  605. <tr id="taxPointDiv">
  606. <th><span class="red">*</span>机构税率:</th>
  607. <td>
  608. <span><form:input path="taxPoint" maxlength="5" cssStyle="width: 35PX" class="number"
  609. onchange="setTwoNumberDecimal(this)"/>%</span>
  610. </td>
  611. </tr>
  612. <tr id="supplierTaxPointDiv">
  613. <th><span class="red">*</span>供应商税率:</th>
  614. <td>
  615. <span><form:input path="supplierTaxPoint" maxlength="5" cssStyle="width: 35PX" class="number"
  616. onchange="setTwoNumberDecimal(this)"/>%</span>
  617. </td>
  618. </tr>
  619. <tr>
  620. <th><span class="red">*</span>商品可见度:</th>
  621. <td colspan="3">
  622. <form:select path="visibility" class="input-large required">
  623. <form:option value="3" label="所有人可见"/>
  624. <form:option value="2" label="所有机构可见"/>
  625. <form:option value="1" label="仅资质机构可见"/>
  626. <form:option value="4" label="仅医美机构可见"/>
  627. </form:select>
  628. </td>
  629. </tr>
  630. <tr>
  631. <th><span class="red">*</span>价格可见度:</th>
  632. <td colspan="3">
  633. <form:select path="priceFlag" class="input-large required">
  634. <form:option value="0" label="所有机构可见"/>
  635. <form:option value="2" label="仅资质机构可见"/>
  636. <form:option value="3" label="仅医美机构可见"/>
  637. <form:option value="1" label="价格不可见"/>
  638. </form:select>
  639. </td>
  640. </tr>
  641. <tr>
  642. <th><span class="red">*</span>商品详情可见度:</th>
  643. <td colspan="3">
  644. <form:select path="commodityDetailsFlag" class="input-large required">
  645. <form:option value="1" label="所有人可见"/>
  646. <form:option value="2" label="所有机构可见"/>
  647. <form:option value="3" label="仅资质机构可见"/>
  648. <form:option value="4" label="仅医美机构可见"/>
  649. </form:select>
  650. </td>
  651. </tr>
  652. <tr>
  653. <th><span class="red">*</span>能否退货:</th>
  654. <td colspan="3">
  655. <form:select path="returnGoodsStutas" class="input-large required" id="goods">
  656. <%-- ${product.returnGoodsStutas=="1" ? "selected" : ""}--%>
  657. <form:option value="1" label="能" />
  658. <form:option value="2" label="不能"/>
  659. </form:select>
  660. </td>
  661. </tr>
  662. <tr>
  663. <th><span class="red">*</span>购买数量:</th>
  664. <td colspan="3">
  665. <label><input type="radio" name="step" value="1" ${product.step == "1" ? "checked" : ""}>逐步增长<b
  666. class="line">|</b></label>
  667. <label><input type="radio" name="step" value="2" ${product.step == "2" ? "checked" : ""}>以起订量增长</label>
  668. </td>
  669. </tr>
  670. <tr>
  671. <th><span class="red">*</span>运费:</th>
  672. <%--<td colspan="3">
  673. <label><input type="radio" name="byFlag" value="0" ${product.byFlag == "0" ? "checked" : ""}>买家承担<b class="line">|</b></label>
  674. <label><input type="radio" name="byFlag" value="1" ${product.byFlag == "1" ? "checked" : ""}>卖家承担</label>
  675. </td>--%>
  676. <td colspan="3">
  677. <label><input type="radio" name="freePostFlag"
  678. value="2" ${(empty product.freePostFlag || product.freePostFlag eq "2") ? "checked" : ""}>默认(遵循运费规则)<b
  679. class="line">|</b></label>
  680. <label><input type="radio" name="freePostFlag"
  681. value="0" ${product.freePostFlag == "0" ? "checked" : ""}>包邮<b class="line">|</b></label>
  682. <label><input type="radio" name="freePostFlag"
  683. value="1" ${product.freePostFlag == "1" ? "checked" : ""}>到付</label>
  684. </td>
  685. </tr>
  686. <tr>
  687. <th><span class="red">*</span>销售区域:</th>
  688. <td colspan="3">
  689. <label><input type="radio" name="allAreaFlag" value="1"
  690. onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "checked" : ""}>全部区域<b
  691. class="line">|</b></label>
  692. <label><input type="radio" name="allAreaFlag" value="0"
  693. onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "" : "checked"}>指定区域</label>
  694. </td>
  695. </tr>
  696. <tr>
  697. <th><span class="red">*</span>首页新品展示:</th>
  698. <td colspan="3">
  699. <c:if test="${product.newProductType==1}">
  700. <input type="radio" checked="checked" name="newProductType" value="1" class="required"/>参与新品展示
  701. <input type="radio" name="newProductType" value="2" class="required"/>不参与新品展示
  702. </c:if>
  703. <c:if test="${empty product.newProductType || product.newProductType==2}">
  704. <input type="radio" name="newProductType" value="1" class="required"/>参与新品展示
  705. <input type="radio" checked="checked" name="newProductType" value="2" class="required"/>不参与新品展示
  706. </c:if>
  707. </td>
  708. </tr>
  709. <tr>
  710. <th>商品说明:</th>
  711. <td colspan="3">
  712. <form:textarea path="productDescribe" id="wipeRemarks" maxlength="200" placeholder="请输入备注文字,不能超过200字"
  713. class="input-xlarge" rows="4"></form:textarea>
  714. <p style="width:500px;text-align:left;"><span id="remarkLen" style="color:red;">0</span>/200</p>
  715. </td>
  716. </tr>
  717. <tr id="allAreaInput">
  718. <th></th>
  719. <td>
  720. <span>
  721. <form:checkboxes path="provinceIDs" items="${provinceList}" itemLabel="name" itemValue="id"/>
  722. </span>
  723. </td>
  724. </tr>
  725. <tr>
  726. <th>订购方案:</th>
  727. <td colspan="3">
  728. <div class="detailInfoEditor" style="width: 620px;">
  729. <form:textarea path="orderInfo" class="input-xlarge hide"/>
  730. <!-- 富文本编辑器 -->
  731. <div id="orderInfoEditor">${product.orderInfo}</div>
  732. </div>
  733. </td>
  734. </tr>
  735. <tr>
  736. <th>服务详情:</th>
  737. <td colspan="3">
  738. <div class="detailInfoEditor" style="width: 620px;">
  739. <form:textarea path="serviceInfo" class="input-xlarge hide"/>
  740. <!-- 富文本编辑器 -->
  741. <div id="serviceInfoEditor">${product.serviceInfo}</div>
  742. </div>
  743. </td>
  744. </tr>
  745. <tr>
  746. <th><span class="red">*</span>资质机构商品详情:</th>
  747. <td><span style="color: red">(适用于资质机构)</span></td>
  748. <th><span class="red">*</span>普通机构商品详情:</th>
  749. <td><span style="color: red">(适用于游客和个人机构,可选择是否和资质机构商品详情相同,不相同的话需要编辑内容)</span>
  750. <label>
  751. <input type="radio"
  752. name="productDetail"
  753. value="1" ${product.productDetail == "1" ? "checked" : ""} />同资质机构商品详情<b
  754. class="line">|</b>
  755. </label>
  756. <label>
  757. <input type="radio"
  758. name="productDetail"
  759. value="2" ${product.productDetail == "2" || product.productDetail == null ? "checked" : ""} />不同于资质机构商品详情(即使用以下编辑内容)
  760. </label>
  761. </td>
  762. </tr>
  763. <tr>
  764. <td colspan="2" style="vertical-align: top;">
  765. <div class="detailInfoEditor" style="width: 620px;">
  766. <form:textarea path="detailInfo" htmlEscape="false" class="input-xlarge required hide"/>
  767. <!-- 富文本编辑器 -->
  768. <div id="detailInfoEditor">${product.detailInfo}</div>
  769. </div>
  770. </td>
  771. <td colspan="3" style="vertical-align: top;">
  772. <div class="detailInfoEditor" style="width: 620px;">
  773. <form:textarea path="commonDetailInfo" htmlEscape="false" class="input-xlarge required hide"/>
  774. <!-- 富文本编辑器 -->
  775. <div id="detailInfoEditor2">${product.commonDetailInfo==""||product.commonDetailInfo==null?"若要查看更多产品信息,请注册机构会员,如有疑问请联系客服。":product.commonDetailInfo}</div>
  776. </div>
  777. </td>
  778. </tr>
  779. <tr>
  780. <td colspan="4" style="text-align:center;">
  781. <shiro:hasPermission name="product:product:edit">
  782. <input id="btnSave" class="btn btn-primary" type="submit" value="保 存" onclick="return checkInfo()"/>
  783. </shiro:hasPermission>
  784. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  785. </td>
  786. </tr>
  787. </table>
  788. </form:form>
  789. <!-- 富文本编辑器 -->
  790. <script type="text/html" id="skuTemplate">
  791. <div class="sku">
  792. <input type="hidden" name="skuId">
  793. <div class="sku-item sku-unit">
  794. <span class="red">*</span>包装规格:
  795. <input name="unit" type="text" maxlength="15" style="width: 40px" class="short required"/>
  796. </div>
  797. <div class="sku-item sku-normalPrice">
  798. <span class="red">*</span>市场价:
  799. <input style="width: 60px" name="normalPrice" type="number" maxlength="10"
  800. class="short input-small required"/>元
  801. </div>
  802. <div class="sku-item sku-stock">
  803. <span>库存:</span>
  804. <input name="stock" style="width: 50px" type="number" maxlength="11" class="short"/>
  805. </div>
  806. <div class="sku-item sku-costCheckFlag">
  807. <span class="red">*</span>成本:
  808. <label><input type="radio" name="costCheckFlag" value="1" checked/>固定成本</label>
  809. <b class="line">|</b>
  810. <label><input type="radio" name="costCheckFlag" value="2"/>比例成本</label>
  811. </div>
  812. <div class="sku-item sku-costPrice">
  813. <span class="red">*</span>
  814. <span class="costFlagText">成本价</span>:
  815. <input style="width: 60px" name="costPrice" type="number" maxlength="11" class="short"/> 元
  816. </div>
  817. <div class="sku-item sku-costProportional" style="display: none;">
  818. <span class="red">*</span>比例成本百分比:
  819. <input style="width: 50px" name="costProportional" type="number" maxlength="11" class="short"/>%
  820. </div>
  821. <div class="sku-item sku-price">
  822. <span class="red">*</span>机构价:
  823. <input name="price" type="number" id="price" maxlength="11" style="width: 70px"
  824. class="short computedPrice required"
  825. onkeyup="computedPriceLevel(this.value)"/>
  826. </div>
  827. <div class="sku-item sku-ladderPriceFlag">
  828. <span class="red">*</span>商品展示价格:
  829. <label> <input type="radio" name="ladderPriceFlag" value="0" checked/> 不使用阶梯价格
  830. </label>
  831. <b class="line">|</b>
  832. <label> <input type="radio" name="ladderPriceFlag" value="1"/>使用阶梯价格</label>
  833. </div>
  834. <div class="sku-item sku-minBuyNumber">
  835. <span class="red">*</span>起订量:
  836. <input style="width: 40px" type="number" name="minBuyNumber" maxlength="11" class="short"/>
  837. </div>
  838. <div><span><button class="deleteSku" onclick="deleteDiv(this)">删除SKU</button></span></div>
  839. <div class="ladderPriceBox" style="display: none;">
  840. <div class="ladderPrice">
  841. 起订量:
  842. <input name="buyNum" min="1" type="number" maxlength="11" buyNum class="short number"/>(${product.unit})及以上,
  843. <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
  844. <a class="addBtn" href="javascript:;">添加</a>
  845. <input type="hidden" name="id"/>
  846. <input class="delFlag" type="hidden" value="1" name="delFlag"/>
  847. </span>
  848. </div>
  849. <div class="ladderPrice" style="display: none">
  850. 起订量:
  851. <input name="buyNum" type="number" maxlength="11" class="short number"/>(${product.unit})及以上,
  852. <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
  853. <a class="delBtn" href="javascript:;">删除</a>
  854. <a class="addBtn" href="javascript:;">添加</a>
  855. <input type="hidden" name="id"/>
  856. <input class="delFlag" type="hidden" value="1" name="delFlag"/>
  857. </span>
  858. </div>
  859. <div class="ladderPrice" style="display: none">
  860. 起订量:
  861. <input name="buyNum" type="number" maxlength="11" class="short number"/>(${product.unit})及以上,
  862. <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
  863. <a class="delBtn" href="javascript:;">删除</a>
  864. </span>
  865. <input type="hidden" name="id"/>
  866. <input class="delFlag" type="hidden" value="1" name="delFlag"/>
  867. </div>
  868. </div>
  869. </div>
  870. </script>
  871. <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
  872. <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
  873. <script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
  874. <script type="text/javascript" src="${ctxStatic}/bootstrap-select/js/bootstrap-select.js"></script>
  875. <script type="text/javascript">
  876. /*$(function () {
  877. // debugger
  878. var productType= $("#productType").val();
  879. if (productType=="2"){
  880. $("#s2id_priceFlag").val(3);
  881. $("#s2id_visibility").val(4);
  882. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  883. $("#priceFlag").prev().find(".select2-chosen").text("仅对医美机构开放");
  884. $("#priceFlag").prop("disabled",true);
  885. $("#visibility").prop("disabled",true);
  886. }
  887. });*/
  888. //关键词联动
  889. function autocomplete(text) {
  890. // return ['三全鲜食(北新泾店)', 'Hot honey 首尔炸鸡(仙霞路)', '新旺角茶餐厅', '泷千家(天山西路店)', '胖仙女纸杯蛋糕(上海凌空店)', '贡茶', '豪大大香鸡排超级奶爸', '茶芝兰(奶茶,手抓饼)', '十二泷町', '星移浓缩咖啡', '阿姨奶茶/豪大大', '新麦甜四季甜品炸鸡', 'Monica摩托主题咖啡店', '浮生若茶(凌空soho店)', 'NONO JUICE 鲜榨果汁', 'CoCo都可(北新泾店)', '快乐柠檬(神州智慧店)', 'Merci Paul cafe', '猫山王(西郊百联店)', '枪会山', '纵食', '钱记', '壹杯加', '唦哇嘀咖', '爱茜茜里(西郊百联)', '爱茜茜里(近铁广场)', '鲜果榨汁(金沙江路和美广店)', '开心丽果(缤谷店)', '超级鸡车(丰庄路店)', '妙生活果园(北新泾店)', '香宜度麻辣香锅', '凡仔汉堡(老真北路店)', '港式小铺', '蜀香源麻辣香锅(剑河路店)', '北京饺子馆', '饭典*新简餐(凌空SOHO店)', '焦耳·川式快餐(金钟路店)', '动力鸡车', '浏阳蒸菜', '四海游龙(天山西路店)', '樱花食堂(凌空店)', '壹分米客家传统调制米粉(天山店)', '福荣祥烧腊(平溪路店)', '速记黄焖鸡米饭', '红辣椒麻辣烫', '(小杨生煎)西郊百联餐厅', '阳阳麻辣烫', '南拳妈妈龙虾盖浇饭'].filter(function (item) {
  891. // return text && item.indexOf(text) > -1;
  892. // });
  893. var keywordlist=new Array();
  894. <c:forEach items="${SearchFrequencyVo}" var="search">
  895. keywordlist.push("${search.keyword}")
  896. </c:forEach>
  897. return keywordlist.filter(function (item) {
  898. return text && item.indexOf(text) > -1;
  899. });
  900. }
  901. new AutoComplete({
  902. el: '.auto-input',
  903. callback: autocomplete,
  904. offsetLeft: -25
  905. });
  906. function js() {
  907. var val = $("#productType").val();
  908. var mac = $("#machineType").val();
  909. if (val == '2') {
  910. if (mac == '1') {
  911. // 械字号一类
  912. $("#visibility").val(3);
  913. $("#priceFlag").val(0);
  914. $("#commodityDetailsFlag").val(1);
  915. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  916. $("#priceFlag").prev().find(".select2-chosen").text("对所有机构公开");
  917. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("所有人可见");
  918. } else if (mac == '2') {
  919. // 械字号二类
  920. $("#visibility").val(3);
  921. $("#priceFlag").val(3);
  922. $("#commodityDetailsFlag").val(4);
  923. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  924. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  925. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  926. } else if (mac == '3') {
  927. // 械字号三类
  928. $("#visibility").val(3);
  929. $("#priceFlag").val(3);
  930. $("#commodityDetailsFlag").val(4);
  931. $("#visibility").prev().find(".select2-chosen").text("所有人可见");
  932. $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  933. $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
  934. }
  935. } else {
  936. $("#priceFlag").prop("disabled", false);
  937. $("#visibility").prop("disabled", false);
  938. $("#commodityDetailsFlag").prop("disabled", false);
  939. }
  940. }
  941. $(document).ready(function () {
  942. $('body').on('keyup', '#wipeRemarks', function () {
  943. $('#remarkLen').text($(this).val().length);
  944. });
  945. //$("#name").focus();
  946. $("#inputForm").validate({
  947. ignore: "",
  948. submitHandler: function (form) {
  949. var commodityType = $("input[name='commodityType']:checked").val();
  950. if (commodityType == '' || commodityType == null) {
  951. alertx("请选择商品属性");
  952. return false;
  953. }
  954. var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  955. if (costCheckFlag * 1 === 1) {
  956. if ($("#costPrice").val() == '') {
  957. alertx("请输入成本价");
  958. return false;
  959. }
  960. ;
  961. } else {
  962. if ($("#costProportional").val() == '') {
  963. alertx("请输入成本比例");
  964. return false;
  965. }
  966. ;
  967. }
  968. if ($('#minBuyNumber:visible').length > 0) {
  969. var minBuyNumber = $('#minBuyNumber').val();
  970. if (minBuyNumber <= 0 || minBuyNumber == '') {
  971. alertx("请输入起订量");
  972. return false;
  973. }
  974. }
  975. if ($('input[name="ladderPriceList[0].buyNum"]:visible').length > 0) {
  976. var buyNum = $('input[name="ladderPriceList[0].buyNum"]').val();
  977. var buyPrice = $('input[name="ladderPriceList[0].buyPrice"]').val();
  978. if (buyNum <= 0 || buyNum == '' || buyPrice <= 0 || buyPrice == '') {
  979. alertx("请输入正确的阶梯价格");
  980. return false;
  981. }
  982. }
  983. if ($('input[name="ladderPriceList[1].buyNum"]:visible').length > 0) {
  984. var buyNum1 = $('input[name="ladderPriceList[1].buyNum"]').val();
  985. var buyPrice1 = $('input[name="ladderPriceList[1].buyPrice"]').val();
  986. if (buyNum1 <= 0 || buyNum1 == '' || buyPrice1 <= 0 || buyPrice1 == '') {
  987. alertx("请输入正确的阶梯价格");
  988. return false;
  989. }
  990. }
  991. if ($('input[name="ladderPriceList[2].buyNum"]:visible').length > 0) {
  992. var buyNum2 = $('input[name="ladderPriceList[2].buyNum"]').val();
  993. var buyPrice2 = $('input[name="ladderPriceList[2].buyPrice"]').val();
  994. if (buyNum2 <= 0 || buyNum2 == '' || buyPrice2 <= 0 || buyPrice2 == '') {
  995. alertx("请输入正确的阶梯价格");
  996. return false;
  997. }
  998. }
  999. var detailInfo = detailInfoEditor.getData();
  1000. if (detailInfo == '') {
  1001. alertx("请输入商品详细信息");
  1002. return false;
  1003. }
  1004. var includedTax = $("input[name='includedTax']:checked").val();
  1005. if (includedTax == '' || includedTax == null) {
  1006. alertx("请选择是否含税");
  1007. return false;
  1008. }
  1009. var invoiceType = $("input[name='invoiceType']:checked").val();
  1010. if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
  1011. var taxPoint = $("#taxPoint").val();
  1012. var supplierTaxPoint = $("#supplierTaxPoint").val();
  1013. if (taxPoint == '' || taxPoint == null) {
  1014. alertx("请输入机构税率");
  1015. return false;
  1016. }
  1017. if (supplierTaxPoint == '' || supplierTaxPoint == null) {
  1018. alertx("请输入供应商税率");
  1019. return false;
  1020. }
  1021. }
  1022. if (includedTax != ${product.includedTax} || invoiceType != ${product.invoiceType}) {
  1023. 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) {
  1024. if (v == 'ok') {
  1025. // 提交订单
  1026. loading('正在提交,请稍等...');
  1027. form.submit();
  1028. }
  1029. }, {
  1030. buttonsFocus: 1, closed: function () {
  1031. if (typeof closed == 'function') {
  1032. closed();
  1033. }
  1034. }
  1035. });
  1036. } else {
  1037. loading('正在提交,请稍等...');
  1038. form.submit();
  1039. }
  1040. },
  1041. errorContainer: "#messageBox",
  1042. errorPlacement: function (error, element) {
  1043. $("#messageBox").text("输入有误,请先更正。");
  1044. if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
  1045. error.appendTo(element.parent().parent());
  1046. } else {
  1047. error.insertAfter(element);
  1048. }
  1049. }
  1050. });
  1051. // 初始化sku
  1052. insertDefaultSkuRow();
  1053. // 初始化关联标签库
  1054. initLabelSelects();
  1055. });
  1056. function initLabelSelects(){
  1057. var labelSelectBox = $('#labelSelectBox');
  1058. labelSelectBox.selectpicker({
  1059. liveSearch: true,
  1060. noneSelectedText: '请选择标签库',
  1061. maxOptions: 6,
  1062. maxOptionsText: '最多选取6个标签库'
  1063. });
  1064. // 回显操作
  1065. var str = '${product.labelIds}';
  1066. if(!str) return;
  1067. var arr = str.split(',');
  1068. console.log(arr);
  1069. labelSelectBox.selectpicker('val', arr);
  1070. }
  1071. <%--// 商品可见度--%>
  1072. <%--/*$(function() {--%>
  1073. <%-- var initValue = ${(product.visibility <= 0) ? 3 : ((product.visibility >= 3) ? 3 : product.visibility)}--%>
  1074. <%-- var select = $("#visibility");--%>
  1075. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1076. <%-- min: 1,--%>
  1077. <%-- max: 3,--%>
  1078. <%-- range: "min",--%>
  1079. <%-- value: initValue,--%>
  1080. <%-- slide: function(event, ui) {--%>
  1081. <%-- if (ui.value*1 === 1){--%>
  1082. <%-- // 所有可见--%>
  1083. <%-- select.val(1);--%>
  1084. <%-- } else if (ui.value*1 === 2){--%>
  1085. <%-- // 会员可见--%>
  1086. <%-- select.val(2);--%>
  1087. <%-- } else{--%>
  1088. <%-- // 不可见--%>
  1089. <%-- select.val(3);--%>
  1090. <%-- }--%>
  1091. <%-- $("#visibilityNote").text(select.find("option:selected").text());--%>
  1092. <%-- }--%>
  1093. <%-- });--%>
  1094. <%--});*/--%>
  1095. <%--// 价格可见度: 1不公开价格,3仅对医美机构公开,2仅对会员机构公开,0公开价格--%>
  1096. <%--// 对应滑块:1->2->3->4--%>
  1097. <%--$(function() {--%>
  1098. <%-- var initValue = ${(product.priceFlag eq 0) ? 2 : ((product.priceFlag eq 2) ? 1 : 0)}--%>
  1099. <%-- var initValue = ${(product.priceFlag eq 1) ? 1 : ((product.priceFlag eq 3) ? 2 : ((product.priceFlag eq 2) ? 3 : 4))}--%>
  1100. <%-- var select = $("#priceFlag");--%>
  1101. <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
  1102. <%-- min: 1,--%>
  1103. <%-- max: 4,--%>
  1104. <%-- range: "min",--%>
  1105. <%-- value: initValue,--%>
  1106. <%-- slide: function(event, ui) {--%>
  1107. <%-- if (ui.value*1 === 4){--%>
  1108. <%-- // 所有可见--%>
  1109. <%-- select.val(0);--%>
  1110. <%-- } else if (ui.value*1 === 3){--%>
  1111. <%-- // 会员可见--%>
  1112. <%-- select.val(2);--%>
  1113. <%-- } else if (ui.value*1 === 2){--%>
  1114. <%-- // 医美可见--%>
  1115. <%-- select.val(3);--%>
  1116. <%-- } else{--%>
  1117. <%-- // 不可见--%>
  1118. <%-- select.val(1);--%>
  1119. <%-- }--%>
  1120. <%-- //select[0].selectedIndex = ui.value;--%>
  1121. <%-- $("#textFlagNote").text(select.find("option:selected").text());--%>
  1122. <%-- }--%>
  1123. <%-- });--%>
  1124. <%--});--%>
  1125. function getCodes(data) {
  1126. var opts = "<option value=''>请选择</option>";
  1127. $.ajax({
  1128. type: "POST",
  1129. url: "${ctx}/product/new/getCodes",
  1130. data: {"shopId": data},
  1131. success: function (res) {
  1132. console.log("data------------------->" + res)
  1133. for (let i = 0; i < res.length; i++) {
  1134. opts += "<option value='" + res[i].splitCode + "'>" + res[i].codeName + "</option>";
  1135. }
  1136. console.log(opts);
  1137. $("#getCode").html('').append(opts);
  1138. },
  1139. error: function (res) {
  1140. }
  1141. });
  1142. }
  1143. //图片初始化
  1144. if (${product.shopType == 2}) {
  1145. $(function () {
  1146. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  1147. var realLength = 0;
  1148. var maxChange = "1";
  1149. for (var i = 0; i < str.length; i++) {
  1150. charCode = str.charCodeAt(i);
  1151. if (charCode >= 0 && charCode <= 128)
  1152. realLength += 1;
  1153. else {
  1154. realLength += 2;
  1155. maxChange = "2";
  1156. }
  1157. }
  1158. if (maxChange == "2") {
  1159. var s = str.substr(0, 16);
  1160. $(searckThis).val(s);
  1161. }
  1162. if (realLength > maxlength) {
  1163. alertx("关键字最多16个汉字,即32个字符!");
  1164. }
  1165. }
  1166. $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1167. $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
  1168. $('.upload-content .conList').find('.cancel-upload').hide();
  1169. var observeEle = document.getElementsByClassName('upload-content')[0];
  1170. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  1171. var MutationObserverConfig = {
  1172. childList: true,
  1173. subtree: true,
  1174. characterData: true
  1175. };
  1176. var observer = new MutationObserver(function (mutations) {
  1177. $.each(mutations, function (index, item) {
  1178. if (item.type === 'childList') {
  1179. // 在创建新的 element 时调用
  1180. var target = $(item.target),
  1181. thisWrapper = target.closest('.conList'),
  1182. nextEle = thisWrapper.next();
  1183. thisWrapper.find('li').css('z-index', 99);
  1184. thisWrapper.find('.cancel-upload').show();
  1185. if (nextEle.hasClass('hide-pic')) {
  1186. nextEle.removeClass('hide-pic');
  1187. }
  1188. }
  1189. })
  1190. });
  1191. observer.observe(observeEle, MutationObserverConfig);
  1192. $('body').on('click', '.upload-content li', function () {
  1193. var index = $(this).closest('.conList').index() + 1,
  1194. str = 'image' + index + 'FinderOpen';
  1195. eval(str + '()');
  1196. });
  1197. $('body').on('click', '.cancel-upload', function () {
  1198. var wrapper = $(this).closest('.conList');
  1199. wrapper.find('li').css('z-index', '-1');
  1200. wrapper.find('input').val('');
  1201. $(this).hide();
  1202. if ($('.cancel-upload:visible').length < 5) {
  1203. wrapper.addClass("hide-pic");
  1204. } else {
  1205. wrapper.removeClass("hide-pic");
  1206. }
  1207. wrapper.parent().append(wrapper.clone());
  1208. wrapper.remove();
  1209. $(".conList").each(function (i, ele) {
  1210. if ($(ele).find("input.input-xlarge").val()) {
  1211. $(ele).next().removeClass("hide-pic")
  1212. }
  1213. })
  1214. });
  1215. $(window).on("load", function () {
  1216. setTimeout(function () {
  1217. $("#secondHandImage").find("input.input-xlarge").each(function (i, ele) {
  1218. if ($(ele).val()) {
  1219. $(ele).next().find("li").css("z-index", "99");
  1220. $(ele).parents(".conList").find(".cancel-upload").show();
  1221. $(ele).parents(".conList").next().removeClass("hide-pic")
  1222. }
  1223. })
  1224. }, 500);
  1225. });
  1226. $('.upload-content-image .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
  1227. $('.upload-content-image .conList .btn:nth-of-type(2)').after('<img class="cancel-upload-image" src="/static/images/close-btn1.png">').remove();
  1228. $('.upload-content-image .conList').find('.cancel-upload-image').hide();
  1229. var observeEleImage = document.getElementsByClassName('upload-content-image')[0];
  1230. // var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
  1231. var MutationObserverImage = window.MutationObserver || window.WebKitMutationObserver;
  1232. var MutationObserverConfigImage = {
  1233. childList: true,
  1234. subtree: true,
  1235. characterData: true
  1236. };
  1237. var observerImage = new MutationObserverImage(function (mutations) {
  1238. $.each(mutations, function (index, item) {
  1239. if (item.type === 'childList') {
  1240. // 在创建新的 element 时调用
  1241. var target = $(item.target),
  1242. thisWrapper = target.closest('.conList'),
  1243. nextEle = thisWrapper.next();
  1244. thisWrapper.find('li').css('z-index', 99);
  1245. thisWrapper.find('.cancel-upload-image').show();
  1246. if (nextEle.hasClass('hide-pic-image')) {
  1247. nextEle.removeClass('hide-pic-image');
  1248. }
  1249. }
  1250. });
  1251. });
  1252. // observerImage.observe(observeEleImage, MutationObserverConfigImage);
  1253. // observerImage.observe(observeEleImage1, MutationObserverConfigImage);
  1254. $('body').on('click', '.upload-content-image li', function () {
  1255. var index = $(this).closest('.conList').index() + 1,
  1256. str = 'remarkImage' + index + 'FinderOpen';
  1257. eval(str + '()');
  1258. });
  1259. $('body').on('click', '.cancel-upload-image', function () {
  1260. var wrapper = $(this).closest('.conList');
  1261. wrapper.find('li').css('z-index', '-1');
  1262. wrapper.find('input').val('');
  1263. $(this).hide();
  1264. wrapper.removeClass("hide-pic-image");
  1265. wrapper.parent().append(wrapper.clone());
  1266. wrapper.remove();
  1267. $(".conList").each(function (i, ele) {
  1268. if ($(ele).find("input.input-xlarge").val()) {
  1269. $(ele).next().removeClass("hide-pic-image")
  1270. }
  1271. })
  1272. });
  1273. });
  1274. }
  1275. /**
  1276. * @param obj
  1277. * jquery控制input只能输入数字和两位小数
  1278. */
  1279. function num(obj) {
  1280. obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
  1281. obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
  1282. obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
  1283. obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  1284. obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
  1285. }
  1286. //初始化标签
  1287. $(function () {
  1288. // debugger
  1289. var html = '';
  1290. //解析参数
  1291. var tagsLists = $("#tagsLists").val();
  1292. if (tagsLists != null && tagsLists != "") {
  1293. var tagsArray = tagsLists.split(',');
  1294. for (var j = 0; j < tagsArray.length; j++) {
  1295. html += '<div class="tags-li"><input id="tags" name="tags" value="' + tagsArray[j] + '" class="tags-s" readonly/><i onclick="removerX(this)">X</i></div>';
  1296. }
  1297. $("#tagsList").append(html).show();
  1298. }
  1299. });
  1300. $(window).load(function () {
  1301. loadInitType();
  1302. });
  1303. var step = ${product.step};
  1304. var areaFlag = ${product.allAreaFlag};
  1305. <%--var ladderPriceFlag = ${product.ladderPriceFlag};--%>
  1306. <%--var normalPrice = ${product.price};--%>
  1307. $(document).ready(function () {
  1308. step * 1 > 1 ? $("#setpInput").show() : $("#setpInput").hide();
  1309. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1310. // computedPriceLevel(normalPrice);
  1311. // if (ladderPriceFlag * 1 > 0) {
  1312. // $("#ladderPriceBox").show();
  1313. // $("#priceMinNumber").hide();
  1314. // } else {
  1315. // $("#ladderPriceBox").hide();
  1316. // $("#priceMinNumber").show();
  1317. // }
  1318. // changeCostPriceShow();
  1319. //富文本框
  1320. ClassicEditor.create(document.querySelector('#detailInfoEditor'), {
  1321. ckfinder: {
  1322. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1323. }
  1324. }).then(function (editor) {
  1325. window.detailInfoEditor = editor;
  1326. }).catch(function (error) {
  1327. console.log(error);
  1328. });
  1329. //富文本框
  1330. ClassicEditor.create(document.querySelector('#detailInfoEditor2'), {
  1331. ckfinder: {
  1332. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1333. }
  1334. }).then(function (editor) {
  1335. window.detailInfoEditor2 = editor;
  1336. }).catch(function (error) {
  1337. console.log(error);
  1338. });
  1339. ClassicEditor.create(document.querySelector('#orderInfoEditor'), {
  1340. ckfinder: {
  1341. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1342. }
  1343. }).then(function (editor) {
  1344. window.orderInfoEditor = editor;
  1345. }).catch(function (error) {
  1346. console.log(error);
  1347. });
  1348. ClassicEditor.create(document.querySelector('#serviceInfoEditor'), {
  1349. ckfinder: {
  1350. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  1351. }
  1352. }).then(function (editor) {
  1353. window.serviceInfoEditor = editor;
  1354. }).catch(function (error) {
  1355. console.log(error);
  1356. });
  1357. });
  1358. //富文本框编辑
  1359. function checkInfo() {
  1360. // debugger
  1361. var productType = $("#productType").val();
  1362. var qualificationNo = $('#qualificationNo').val()
  1363. var productName = $("#productName").val();
  1364. var qualificationTime = $('#qualificationTime').val()
  1365. var qualificationLink = $("#qualificationLink").val();
  1366. if (productType == "2") {
  1367. if (qualificationNo == null || qualificationNo == "") {
  1368. alertx("请输入证书编号");
  1369. return false;
  1370. }
  1371. if (productName == null || productName == "") {
  1372. alertx("请输入产品名称");
  1373. return false;
  1374. }
  1375. if (qualificationTime == null || qualificationTime == "") {
  1376. alertx("请输入证书有效时间");
  1377. return false;
  1378. }
  1379. if (qualificationLink == null || qualificationLink == "") {
  1380. alertx("请输入证书有效链接");
  1381. return false;
  1382. }
  1383. }
  1384. var detailInfo = detailInfoEditor.getData();
  1385. $("#detailInfo").val(detailInfo);
  1386. var commonDetailInfo = detailInfoEditor2.getData();
  1387. $("#commonDetailInfo").val(commonDetailInfo);
  1388. console.log(detailInfo);
  1389. var orderInfo = orderInfoEditor.getData();
  1390. $("#orderInfo").val(orderInfo);
  1391. console.log(orderInfo);
  1392. var serviceInfo = serviceInfoEditor.getData();
  1393. $("#serviceInfo").val(serviceInfo);
  1394. console.log(serviceInfo);
  1395. }
  1396. // $("#ladderPrice1").on("click", ".addBtn", function () {
  1397. // $("#ladderPrice2").removeClass("hide");
  1398. // $("#delFlag2").val("0");
  1399. // $("#ladderPrice1").find(".showBtn").addClass("hide");
  1400. // });
  1401. // $("#ladderPrice2").on("click", ".addBtn", function () {
  1402. // $("#ladderPrice3").removeClass("hide");
  1403. // $("#delFlag3").val("0");
  1404. // $("#ladderPrice2").find(".showBtn").addClass("hide");
  1405. // }).on("click", ".delBtn", function () {
  1406. // $("#ladderPrice2").addClass("hide");
  1407. // $("#ladderPrice1").find(".showBtn").removeClass("hide");
  1408. // $("#delFlag2").val("1");
  1409. // });
  1410. // $("#ladderPrice3").on("click", ".delBtn", function () {
  1411. // $("#ladderPrice3").addClass("hide");
  1412. // $("#ladderPrice2").find(".showBtn").removeClass("hide");
  1413. // $("#delFlag3").val("1");
  1414. // });
  1415. //计算游客用户价格等级
  1416. function computedPriceLevel(price) {
  1417. var priceLevel = 1;
  1418. $(".priceIcon").removeClass("full");
  1419. $(".priceIcon").eq(0).addClass("full");
  1420. if (price * 1 > 2.5 * 10000 && price * 1 <= 10 * 10000) {
  1421. priceLevel = 2;
  1422. $(".priceIcon").addClass("full");
  1423. if ($(".priceIcon").eq(2).hasClass("full")) {
  1424. $(".priceIcon").eq(2).removeClass("full");
  1425. }
  1426. if ($(".priceIcon").eq(3).hasClass("full")) {
  1427. $(".priceIcon").eq(3).removeClass("full");
  1428. }
  1429. if ($(".priceIcon").eq(4).hasClass("full")) {
  1430. $(".priceIcon").eq(4).removeClass("full");
  1431. }
  1432. }
  1433. if (price * 1 > 10 * 10000 && price * 1 <= 25 * 10000) {
  1434. priceLevel = 3;
  1435. $(".priceIcon").addClass("full");
  1436. if ($(".priceIcon").eq(3).hasClass("full")) {
  1437. $(".priceIcon").eq(3).removeClass("full");
  1438. }
  1439. if ($(".priceIcon").eq(4).hasClass("full")) {
  1440. $(".priceIcon").eq(4).removeClass("full");
  1441. }
  1442. }
  1443. if (price * 1 > 25 * 10000 && price * 1 <= 50 * 10000) {
  1444. priceLevel = 4;
  1445. $(".priceIcon").addClass("full");
  1446. if ($(".priceIcon").eq(4).hasClass("full")) {
  1447. $(".priceIcon").eq(4).removeClass("full");
  1448. }
  1449. }
  1450. if (price * 1 > 50 * 10000) {
  1451. priceLevel = 5;
  1452. $(".priceIcon").addClass("full");
  1453. }
  1454. }
  1455. // 检查阶梯数量
  1456. // function checkBuyNum(input, index) {
  1457. // if (index > 0) {
  1458. // var beforeNum = $('input[name="ladderPriceList[' + (index - 1) + '].buyNum"]').val() * 1;
  1459. // if (input.value * 1 <= beforeNum) {
  1460. // alertx("请输入大于上一阶起订量的值");
  1461. // $(input).val(input.value * 1 + beforeNum);
  1462. // }
  1463. // } else {
  1464. // var minNum = $('input[name="ladderPriceList[0].buyNum"]').val() * 1;
  1465. // $('#minBuyNumber').val(minNum);
  1466. // }
  1467. // }
  1468. // 检查阶梯价格
  1469. // function checkBuyPrice(input, index) {
  1470. // if (index > 0) {
  1471. // var beforePrice = $('input[name="ladderPriceList[' + (index - 1) + '].buyPrice"]').val() * 1;
  1472. // if (input.value * 1 > beforePrice) {
  1473. // $(input).val('');
  1474. // alertx("请输入小于前一个价格的值");
  1475. // }
  1476. // } else {
  1477. // var price = $('#price').val();
  1478. // if (input.value * 1 > price) {
  1479. // $(input).val('');
  1480. // alertx("第一个阶梯价格不能大于机构价");
  1481. // }
  1482. // }
  1483. // }
  1484. // 是否使用阶梯价格
  1485. function changeLadderPrice() {
  1486. var ladderPriceFlag = $("input[name='ladderPriceFlag']:checked").val();
  1487. var svipFlag = ${product.svipFlag};
  1488. if (svipFlag == 1) {
  1489. alertx("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
  1490. $("input[name='ladderPriceFlag']").get(0).checked = true;
  1491. } else {
  1492. if (ladderPriceFlag * 1 > 0) {
  1493. $("#ladderPriceBox").show();
  1494. $("#priceMinNumber").hide();
  1495. $("#delFlag1").val("0");
  1496. $('input[name="ladderPriceList[0].buyNum"]').val($('#minBuyNumber').val() * 1);
  1497. } else {
  1498. $("#ladderPriceBox").hide();
  1499. $("#priceMinNumber").show();
  1500. }
  1501. }
  1502. }
  1503. // 是否固定成本
  1504. // function changeCostPriceShow() {
  1505. // var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
  1506. // if (costCheckFlag * 1 === 1) {
  1507. // $("#costPriceShow").show();
  1508. // $("#costPropShow").hide();
  1509. // } else {
  1510. // $("#costPriceShow").hide();
  1511. // $("#costPropShow").show();
  1512. // }
  1513. // }
  1514. // 全部区域
  1515. function changeAreaFlag() {
  1516. var areaFlag = $("input[name='allAreaFlag']:checked").val();
  1517. areaFlag * 1 > 0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
  1518. }
  1519. // 网站分类
  1520. var currentBigtype = ${product.bigTypeID};
  1521. var currentSmalltype = ${product.smallTypeID};
  1522. var currentTinytype = ${product.tinyTypeID};
  1523. var currentCommodityType = ${product.commodityType}; //商品属性
  1524. var bigTypeList = [
  1525. <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
  1526. <c:if test="${index.index > 0}">, </c:if>
  1527. {
  1528. bigTypeID: ${bigType.bigTypeID},
  1529. name: "${bigType.name}",
  1530. typeSort: ${bigType.typeSort}
  1531. }
  1532. </c:forEach>
  1533. ];
  1534. var smalltypeList = [
  1535. <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
  1536. <c:if test="${index.index > 0}">, </c:if>
  1537. {
  1538. smallTypeID: ${smalltype.smallTypeID},
  1539. name: "${smalltype.name}",
  1540. bigTypeID: ${smalltype.bigTypeID},
  1541. }
  1542. </c:forEach>
  1543. ];
  1544. var tinytypeList = [
  1545. <c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
  1546. <c:if test="${index.index > 0}">, </c:if>
  1547. {
  1548. tinyTypeID: ${tinytype.tinyTypeID},
  1549. name: "${tinytype.name}",
  1550. smallTypeID: ${tinytype.smallTypeID}
  1551. }
  1552. </c:forEach>
  1553. ];
  1554. // 初始分类
  1555. function loadInitType() {
  1556. if (currentCommodityType == null || typeof (currentCommodityType) == "undefined" || currentCommodityType == '0') {
  1557. $("#bigType").html("");
  1558. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1559. $("#bigType").append("<option value=''>请选择</option>");
  1560. $("#smallType").html("");
  1561. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1562. $("#smallType").append("<option value=''>请选择</option>");
  1563. $("#tinyType").html("");
  1564. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1565. $("#tinyType").append("<option value=''>请选择</option>");
  1566. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1567. } else if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
  1568. setTimeout(function () {
  1569. loadBigType();
  1570. }, 0);
  1571. }
  1572. }
  1573. // 分类联动
  1574. function loadBigType() {
  1575. var commodityType = $("input[name='commodityType']:checked").val();
  1576. $("#bigType").html("");
  1577. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1578. $("#bigType").append("<option value=''>请选择</option>");
  1579. $("#smallType").html("");
  1580. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1581. $("#smallType").append("<option value=''>请选择</option>");
  1582. $("#tinyType").html("");
  1583. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1584. $("#tinyType").append("<option value=''>请选择</option>");
  1585. if (typeof (commodityType) != "undefined") {
  1586. $("#bigType").html("");
  1587. $("#bigType").prev().find(".select2-chosen").text("请选择");
  1588. $("#bigType").append("<option value=''>请选择</option>");
  1589. $("#smallType").html("");
  1590. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1591. $("#smallType").append("<option value=''>请选择</option>");
  1592. $("#tinyType").html("");
  1593. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1594. $("#tinyType").append("<option value=''>请选择</option>");
  1595. for (var i = 0; i < bigTypeList.length; i++) {
  1596. if (commodityType == bigTypeList[i].typeSort) {
  1597. if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeID) {
  1598. $("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1599. $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
  1600. setTimeout(function () {
  1601. loadSmallType();
  1602. }, 500);
  1603. } else {
  1604. $("#bigType").append("<option value='" + bigTypeList[i].bigTypeID + "'>" + bigTypeList[i].name + "</option>");
  1605. }
  1606. }
  1607. }
  1608. }
  1609. loadSmallType();
  1610. trainingShow();
  1611. }
  1612. var conn=0;
  1613. var insertStatus='${product.insertStatus}';
  1614. function loadSmallType(id) {
  1615. if (id) {
  1616. $("#bigType").val(id);
  1617. $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
  1618. }
  1619. var bigType = $("#bigType").val();
  1620. $("#smallType").html("");
  1621. $("#smallType").prev().find(".select2-chosen").text("请选择");
  1622. $("#smallType").append("<option value=''>请选择</option>");
  1623. $("#tinyType").html("");
  1624. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1625. $("#tinyType").append("<option value=''>请选择</option>");
  1626. if (typeof (bigType) != "undefined" && bigType != "") {
  1627. var smallTypeNum = 0;
  1628. for (var i = 0; i < smalltypeList.length; i++) {
  1629. if (bigType == smalltypeList[i].bigTypeID) {
  1630. smallTypeNum = smallTypeNum + 1;
  1631. if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
  1632. $("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1633. $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
  1634. setTimeout(function () {
  1635. loadTinyType(currentSmalltype);
  1636. // loadGoods();
  1637. }, 500);
  1638. } else {
  1639. $("#smallType").append("<option value='" + smalltypeList[i].smallTypeID + "'>" + smalltypeList[i].name + "</option>");
  1640. }
  1641. }
  1642. }
  1643. if (smallTypeNum == 0) {
  1644. $("#smallType").removeClass("required");
  1645. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1646. } else {
  1647. $("#smallType").addClass("required");
  1648. document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
  1649. }
  1650. } else {
  1651. $("#smallType").removeClass("required");
  1652. document.getElementById("s2id_smallType").style.cssText = "display: none";
  1653. }
  1654. loadTinyType();
  1655. if(insertStatus==1){
  1656. conn=1;
  1657. loadGoods(conn);
  1658. insertStatus++;
  1659. }else{
  1660. loadGoods(conn);
  1661. }
  1662. }
  1663. function loadTinyType(id) {
  1664. if (id) {
  1665. $("#smallType").val(id);
  1666. $("#smallType").prev().find(".select2-chosen").text($("#smallType option:selected").text());
  1667. }
  1668. var smallType = $("#smallType option:selected").val();
  1669. $("#tinyType").html("");
  1670. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  1671. $("#tinyType").append("<option value=''>请选择</option>");
  1672. if (typeof (smallType) != "undefined" && smallType != "") {
  1673. var tinyTypeNum = 0;
  1674. for (var i = 0; i < tinytypeList.length; i++) {
  1675. if (smallType == tinytypeList[i].smallTypeID) {
  1676. tinyTypeNum = tinyTypeNum + 1;
  1677. if (currentTinytype != null && typeof (currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
  1678. $("#tinyType").append("<option selected value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1679. $("#tinyType").prev().find(".select2-chosen").text(tinytypeList[i].name);
  1680. } else {
  1681. $("#tinyType").append("<option value='" + tinytypeList[i].tinyTypeID + "'>" + tinytypeList[i].name + "</option>");
  1682. }
  1683. }
  1684. }
  1685. if (tinyTypeNum == 0) {
  1686. $("#tinyType").removeClass("required");
  1687. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1688. } else {
  1689. $("#tinyType").addClass("required");
  1690. document.getElementById("s2id_tinyType").style.cssText = "display: inline-block";
  1691. }
  1692. } else {
  1693. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  1694. $("#tinyType").removeClass("required");
  1695. }
  1696. }
  1697. function loadGoods(id){
  1698. var bigType=null;
  1699. if(id==1){
  1700. if(typeof (bigType) != "undefined" && bigType != ""){
  1701. bigType='${product.returnGoodsStutas}'
  1702. $("#goods").html("");
  1703. $("#goods").prev().find(".select2-chosen").text("请选择");
  1704. $("#goods").append("<option value=''>请选择</option>");
  1705. var not='不能';
  1706. var ye='能';
  1707. if(bigType=='2'){
  1708. $("#goods").append("<option value='1'>" + '能' + "</option>");
  1709. $("#goods").append("<option selected value='2'>" + not + "</option>");
  1710. $("#goods").prev().find(".select2-chosen").text(not);
  1711. }else{
  1712. $("#goods").append("<option selected value='1'>" + ye + "</option>");
  1713. $("#goods").append("<option value='2'>" + '不能' + "</option>");
  1714. $("#goods").prev().find(".select2-chosen").text(ye);
  1715. }
  1716. }
  1717. }else{
  1718. if(typeof (bigType) != "undefined" && bigType != ""){
  1719. bigType = $("#bigType").val();
  1720. $("#goods").html("");
  1721. $("#goods").prev().find(".select2-chosen").text("请选择");
  1722. $("#goods").append("<option value=''>请选择</option>");
  1723. var not='不能';
  1724. var ye='能';
  1725. if(bigType=='1014'||bigType=='1016'||bigType=='1021'||bigType=='1023'){
  1726. $("#goods").append("<option value='1'>" + '能' + "</option>");
  1727. $("#goods").append("<option selected value='2'>" + not + "</option>");
  1728. $("#goods").prev().find(".select2-chosen").text(not);
  1729. }else{
  1730. $("#goods").append("<option selected value='1'>" + ye + "</option>");
  1731. $("#goods").append("<option value='2'>" + '不能' + "</option>");
  1732. $("#goods").prev().find(".select2-chosen").text(ye);
  1733. }
  1734. }
  1735. }
  1736. conn++;
  1737. }
  1738. <%--window.onload=function () {--%>
  1739. <%-- console.log('-----------------------onload')--%>
  1740. <%-- $("#goods").val('${product.returnGoodsStutas}')--%>
  1741. <%--}--%>
  1742. //验证字符串最大长度
  1743. function checkmaxlength(str) {
  1744. var realLength = 0;
  1745. for (var i = 0; i < str.length; i++) {
  1746. charCode = str.charCodeAt(i);
  1747. if (charCode >= 0 && charCode <= 128)
  1748. realLength += 1;
  1749. else
  1750. realLength += 2;
  1751. }
  1752. if (realLength > 100) {
  1753. alertx("商品名称最多50个汉字,即100个字符!当前输入长度为" + realLength);
  1754. }
  1755. }
  1756. //验证字符串最大长度
  1757. function checkmaxlengths(str, maxlength) {
  1758. var realLength = 0;
  1759. for (var i = 0; i < str.length; i++) {
  1760. charCode = str.charCodeAt(i);
  1761. if (charCode >= 0 && charCode <= 128)
  1762. realLength += 1;
  1763. else
  1764. realLength += 2;
  1765. }
  1766. if (realLength > maxlength) {
  1767. alertx("商品名称最多30个汉字,即60个字符!当前输入长度为" + realLength);
  1768. }
  1769. }
  1770. function checkmaxlengthsBySearch(searckThis, str, maxlength) {
  1771. var realLength = 0;
  1772. var maxChange = "1";
  1773. for (var i = 0; i < str.length; i++) {
  1774. charCode = str.charCodeAt(i);
  1775. if (charCode >= 0 && charCode <= 128)
  1776. realLength += 1;
  1777. else {
  1778. realLength += 2;
  1779. maxChange = "2";
  1780. }
  1781. }
  1782. if (maxChange == "2") {
  1783. var s = str.substr(0, 16);
  1784. $(searckThis).val(s);
  1785. }
  1786. if (realLength > maxlength) {
  1787. alertx("关键字最多16个汉字,即32个字符!");
  1788. }
  1789. }
  1790. function checkPrecisehKeyLength(str) {
  1791. var realLength = 0;
  1792. for (var i = 0; i < str.length; i++) {
  1793. charCode = str.charCodeAt(i);
  1794. if (charCode >= 0 && charCode <= 128)
  1795. realLength += 1;
  1796. else
  1797. realLength += 2;
  1798. }
  1799. if (realLength > 160) {
  1800. alertx("精确关键词最多80个汉字,即160个字符!当前输入长度为" + realLength);
  1801. }
  1802. }
  1803. var skuIndex = 0;
  1804. var productJson = ${productJson};
  1805. console.log(productJson);
  1806. var skuList = productJson.skuList;
  1807. $(".addSku").click(function () {
  1808. var skuTemplate = $('#skuTemplate').html()
  1809. $("#skus").append(skuTemplate).show();
  1810. var current = $("#skus").find('.sku').eq(-1);
  1811. var product = {
  1812. skuIndex: ++skuIndex,
  1813. costCheckFlag: '1',
  1814. ladderPriceFlag: '0'
  1815. }
  1816. setSkuPrototypeValues(current, product);
  1817. skuEventBind(current, product);
  1818. })
  1819. function deleteDiv(el){
  1820. el.parentNode.parentNode.parentNode.parentNode.removeChild(el.parentNode.parentNode.parentNode);
  1821. }
  1822. function insertDefaultSkuRow() {
  1823. console.log('skuList', skuList);
  1824. if (skuList) {
  1825. for (var i = 0; i < skuList.length; i++) {
  1826. var skuTemplate = $('#skuTemplate').html();
  1827. $("#skus").append(skuTemplate).show();
  1828. var current = $("#skus").find('.sku').eq(-1);
  1829. var product = skuList[i];
  1830. product.skuIndex = i;
  1831. setSkuPrototypeValues(current, product);
  1832. skuEventBind(current, product);
  1833. skuIndex = i
  1834. }
  1835. }
  1836. // else {
  1837. // var product = {};
  1838. // product.skuIndex = 0;
  1839. // setSkuPrototypeValues(current, product);
  1840. // skuEventBind(current, product);
  1841. // }
  1842. }
  1843. /* 设置新增sku属性值 */
  1844. function setSkuPrototypeValues(el, product) {
  1845. console.log(product);
  1846. if (!product) return;
  1847. var skuIndex = product.skuIndex;
  1848. var index = el.find('input[name$="index"]');
  1849. index.val(skuIndex);
  1850. if(product.skuId){
  1851. var skuId=el.find('input[name$="skuId"]');
  1852. skuId.val(product.skuId);
  1853. skuId.attr('name', 'skuList[' + skuIndex + '].skuId');
  1854. }
  1855. // 包装规格
  1856. var unit = el.find('input[name$="unit"]');
  1857. unit.val(product.unit)
  1858. unit.attr('name', 'skuList[' + skuIndex + '].unit');
  1859. // 市场价
  1860. var normalPrice = el.find('input[name$="normalPrice"]');
  1861. normalPrice.val(product.normalPrice)
  1862. normalPrice.attr('name', 'skuList[' + skuIndex + '].normalPrice');
  1863. // 库存
  1864. var stock = el.find('input[name$="stock"]');
  1865. stock.val(product.stock)
  1866. stock.attr('name', 'skuList[' + skuIndex + '].stock');
  1867. // 成本
  1868. var costCheckFlag = el.find('input[name$="costCheckFlag"]');
  1869. costCheckFlag.attr('name', 'skuList[' + skuIndex + '].costCheckFlag');
  1870. costCheckFlag.eq(0).attr('checked', product.costCheckFlag == 1);
  1871. costCheckFlag.eq(1).attr('checked', product.costCheckFlag != 1);
  1872. // 成本价
  1873. var costPrice = el.find('input[name$="costPrice"]');
  1874. costPrice.val(product.costPrice)
  1875. costPrice.attr('name', 'skuList[' + skuIndex + '].costPrice');
  1876. // 比例成本百分比
  1877. var costProportional = el.find('input[name$="costProportional"]');
  1878. costProportional.val(product.costProportional)
  1879. costProportional.attr('name', 'skuList[' + skuIndex + '].costProportional');
  1880. if (product.costCheckFlag != 1) {
  1881. costProportional.parent('.sku-costProportional').show();
  1882. costPrice.parent('.sku-costPrice').hide();
  1883. } else {
  1884. costPrice.parent('.sku-costPrice').show();
  1885. costProportional.parent('.sku-costProportional').hide();
  1886. }
  1887. // 机构价
  1888. var price = el.find('input[name$="price"]');
  1889. price.val(product.price)
  1890. price.attr('name', 'skuList[' + skuIndex + '].price');
  1891. // 商品展示阶梯价格
  1892. var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
  1893. // 起订量
  1894. var ladderPriceBox = el.find('.ladderPriceBox');
  1895. ladderPriceFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceFlag');
  1896. ladderPriceFlag.eq(0).attr('checked', product.ladderPriceFlag != 1);
  1897. ladderPriceFlag.eq(1).attr('checked', product.ladderPriceFlag == 1);
  1898. // 起订量
  1899. var minBuyNumber = el.find('input[name$="minBuyNumber"]');
  1900. minBuyNumber.val(product.minBuyNumber)
  1901. minBuyNumber.attr('name', 'skuList[' + skuIndex + '].minBuyNumber');
  1902. if (product.ladderPriceFlag == 1) {
  1903. ladderPriceBox.show();
  1904. minBuyNumber.parent('.sku-minBuyNumber').hide();
  1905. }
  1906. ladderPriceBox.find('.ladderPrice').each(function (index, item) {
  1907. var ladderPrice = {}
  1908. if (product.ladderPriceList && product.ladderPriceList.length > 0) {
  1909. ladderPrice = product.ladderPriceList[index] || {};
  1910. }
  1911. console.log('ladderPrice---', ladderPrice)
  1912. // 起订量
  1913. var buyNum = $(item).find('[name$="buyNum"]');
  1914. buyNum.val(ladderPrice.buyNum);
  1915. buyNum.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyNum');
  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>