productEdit.jsp 122 KB

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