productEdit.jsp 87 KB

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