productEdit.jsp 67 KB

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