recommend.jsp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  3. <html>
  4. <head>
  5. <title>相关推荐编辑</title>
  6. <meta name="decorator" content="default"/>
  7. <style>
  8. .table th{text-align:center}
  9. .table td{text-align:center}
  10. .the-shop label{display:inline-block;margin-right:15px;vertical-align:top;width:70px}
  11. .shop-img .img{display:inline-block;width:150px;height:100px;background-color:#ccc;border:1px solid #000}
  12. .shop-img .img img{width:100%;height:100%}
  13. .default-class label{vertical-align:middle}
  14. .default-class span{display:inline-block;width:80px;height:20px;line-height:20px;text-align:center;border:1px solid #666;margin-right:15px;border-radius:15px;vertical-align:middle;cursor:pointer}
  15. .customize-class-ct label{vertical-align:middle}
  16. .customize-class-ct select{width:100px;height:30px;line-height:30px;margin-right:10px;font-size:14px}
  17. .active{color:#00bbd3;border-color:#00bbd3!important}
  18. b.line{margin:0 15px 0 20px;font-weight:normal}
  19. .flex-wrap .item {margin: 10px 10px 10px 20px;}
  20. .form-actions {text-align: center;}
  21. </style>
  22. </head>
  23. <body>
  24. <ul class="nav nav-tabs">
  25. <li><a href="${ctx}/product/new/list">商品列表</a></li>
  26. <li class="active"><a href="${ctx}/product/new/recommend?id=${product.productID}">相关推荐编辑</a></li>
  27. </ul>
  28. <table class="table table-striped table-bordered table-condensed">
  29. <caption>
  30. <p><b>商品名称:</b>${product.name}</p>
  31. <p><b>推荐列表</b><font color="red">(当前列表记录数 ${dbProductNum}, 最多只能添加15条数据)</font></p>
  32. </caption>
  33. <thead>
  34. <tr>
  35. <th>ID</th>
  36. <th>商品名称</th>
  37. <th>包装规格</th>
  38. <th>图片</th>
  39. <th>供应商</th>
  40. <c:if test="${product.recommendType eq 1}">
  41. <th>排序</th>
  42. <shiro:hasPermission name="product:product:edit"><th>操作</th></shiro:hasPermission>
  43. </c:if>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. <c:forEach items="${recommendList}" var="cpr">
  48. <tr>
  49. <td>
  50. ${cpr.recommendProductID}
  51. </td>
  52. <td>
  53. ${cpr.productName}
  54. </td>
  55. <td>
  56. ${cpr.unit}
  57. </td>
  58. <td><img src="${cpr.img}" width="50" height="50"></td>
  59. <td>${cpr.shopName}</td>
  60. <c:if test="${product.recommendType eq 1}">
  61. <td>
  62. <input class="input-small sort-input" data-productid="${cpr.recommendProductID}" name="" value="${cpr.sort}">
  63. </td>
  64. <shiro:hasPermission name="product:product:edit">
  65. <td>
  66. <a href="${ctx}/product/new/recommend/delete?recommendId=${cpr.id}&productID=${cpr.productID}" onclick="return confirmx('确认要删除吗?', this.href)">删除</a>
  67. </td>
  68. </shiro:hasPermission>
  69. </c:if>
  70. </tr>
  71. </c:forEach>
  72. </tbody>
  73. </table>
  74. <input type="hidden" id="productID" value="${product.productID}">
  75. <input type="hidden" id="bigTypeID" value="${bigTypeID}">
  76. <input type="hidden" id="smallTypeID" value="${smallTypeID}">
  77. <input type="hidden" id="tinyTypeID" value="${tinyTypeID}">
  78. <input type="hidden" id="productName" value="${productName}">
  79. <input type="hidden" id="shopName" value="${shopName}">
  80. <div class="flex-wrap">
  81. <div class="item">
  82. <label><font color="red">*</font><b>设置类型:</b></label>
  83. <input type="radio" name="recommendType" value="1" onchange="changeRecommendType()" ${recommendType == "1" ? "checked" : ""} />手动选择<b class="line">|</b>
  84. <input type="radio" name="recommendType" value="0" onchange="changeRecommendType()" ${(recommendType == "0" || recommendType == ""|| recommendType == null) ? "checked" : ""} />自动选择
  85. <span style="color:#D0D0D0;">(设置自动选择后,系统将会选择该商品所属相同二级分类中销量前7名的商品进行推荐)<span/>
  86. </div>
  87. </div>
  88. <div id="p-list" style="display:none;">
  89. <div class="flex-wrap">
  90. <div class="item">
  91. <label>商品分类:</label>
  92. <select id="commodityType" class="input-small" onchange="loadBigType()">
  93. <option value="">请选择</option>
  94. <option value="1">产品</option>
  95. <option value="2">仪器</option>
  96. </select>
  97. <select id="bigType" class="input-small" onchange="loadSmallType()">
  98. <option value="">请选择</option>
  99. </select>
  100. <select id="smallType" class="input-small" onchange="loadTinyType()">
  101. <option value="">请选择</option>
  102. </select>
  103. <select id="tinyType" class="input-small">
  104. <option value="">请选择</option>
  105. </select>
  106. </div>
  107. <div class="item">
  108. <label>商品名称:</label>
  109. <input id="queryProductName" value="${productName}" htmlEscape="false" maxlength="300" class="input-medium" cssStyle="width: 80px"/>
  110. </div>
  111. <div class="item">
  112. <label>供应商:</label>
  113. <input id="queryShopName" value="${shopName}" htmlEscape="false" maxlength="300" class="input-medium" cssStyle="width: 80px"/>
  114. </div>
  115. <div class="item"><input id="queryBtn" class="btn btn-primary" type="submit" value="查询"/></div>
  116. </div>
  117. <table class="table table-striped table-bordered table-condensed">
  118. <thead>
  119. <tr>
  120. <th>ID</th>
  121. <th>商品名称</th>
  122. <th>包装规格</th>
  123. <th>图片</th>
  124. <th>供应商</th>
  125. <th>排序</th>
  126. <shiro:hasPermission name="product:product:edit"><th>操作</th></shiro:hasPermission>
  127. </tr>
  128. </thead>
  129. <tbody>
  130. <c:forEach items="${list}" var="cpr">
  131. <tr>
  132. <td>
  133. ${cpr.productID}
  134. </td>
  135. <td>
  136. ${cpr.productName}
  137. </td>
  138. <td>
  139. ${cpr.unit}
  140. </td>
  141. <td><img src="${cpr.img}" width="50" height="50"></td>
  142. <td>${cpr.shopName}</td>
  143. <td>
  144. <input class="input-small sort-input" data-productid="${cpr.productID}" name="" value="${cpr.sort}">
  145. </td>
  146. <shiro:hasPermission name="product:product:edit">
  147. <td>
  148. <input type="checkbox" data-productid="${cpr.productID}" ${cpr.check ? 'checked="checked" data-db="1"':'data-db="0"'} ${full == 1 ? 'disabled="true"':''} class="recommendProductID" name="recommendProductID"/>
  149. </td>
  150. </shiro:hasPermission>
  151. </tr>
  152. </c:forEach>
  153. </tbody>
  154. </table>
  155. </div>
  156. <div class="form-actions">
  157. <shiro:hasPermission name="product:product:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
  158. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  159. </div>
  160. <script type="text/javascript">
  161. params = [];
  162. var num = '';
  163. dbProductNum = Number('${dbProductNum}');
  164. function page(n,s){
  165. $("#pageNo").val(n);
  166. $("#pageSize").val(s);
  167. $("#searchForm").submit();
  168. return false;
  169. }
  170. $(function () {
  171. // 获取初始分类
  172. loadInitType();
  173. //相关推荐类型 0自动选择; 1手动推荐
  174. if ('${recommendType}' == '0') {
  175. $('#p-list').hide();
  176. }
  177. if ('${recommendType}' == '1') {
  178. $('#p-list').show();
  179. }
  180. $('body').on('click','#queryBtn', function () {
  181. var recommendType = $("input[name='recommendType']:checked").val();
  182. var url = "${ctx}//product/new/recommend?id=" + $("#productID").val() + "&recommendType=" + recommendType;
  183. if ($("#commodityType").val() != '' && $("#commodityType").val() != '请选择') {
  184. url += "&commodityType=" + $("#commodityType").val();
  185. }
  186. if ($("#bigType").val() != '' && $("#bigType").val() != '请选择') {
  187. url += "&bigTypeID=" + $("#bigType").val();
  188. }
  189. if ($("#smallType").val() != '' && $("#smallType").val() != '请选择') {
  190. url += "&smallTypeID=" + $("#smallType").val();
  191. }
  192. if ($("#tinyType").val() != '' && $("#tinyType").val() != '请选择') {
  193. url += "&tinyTypeID=" + $("#tinyType").val();
  194. }
  195. if ($("#queryProductName").val() != '') {
  196. url += "&productName=" + $("#queryProductName").val();
  197. }
  198. if ($("#queryShopName").val() != '') {
  199. url += "&shopName=" + $("#queryShopName").val();
  200. }
  201. window.location.href = url;
  202. });
  203. $('body').on('click','#btnSubmit',function () {
  204. if ('${full}' == '1' || dbProductNum > 15) {
  205. alertx("最多只能添加15条相关商品");
  206. return;
  207. }
  208. var recommendType = $("input[name='recommendType']:checked").val();
  209. var url = "${ctx}/product/new/recommend/add?productID=" + $("#productID").val() + "&recommendType=" + recommendType;
  210. if (recommendType == '1') { //只有选择了手动推荐相关商品单选框才修改相关商品数据
  211. for (var i = 0; i < params.length; i++) {
  212. url += "&params=" + params[i];
  213. }
  214. }
  215. //保留搜索条件
  216. <%--url += "&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}";--%>
  217. window.location.href = url;
  218. });
  219. $('.recommendProductID').on('click', function () {
  220. $this=$(this);
  221. var sortInput = $this.parent().prev().find(".sort-input");
  222. if ($this.is(":checked")) { //选中
  223. sortInput.val(1);
  224. params.push(sortInput.data("productid") + ":" + sortInput.val());
  225. $this.data('db') == '0' && dbProductNum++;
  226. } else { //没选中
  227. sortInput.val(null);
  228. $this.data('db') == '0' && dbProductNum--;
  229. for (var i = 0; i < params.length; i++) {
  230. if (params[i].startsWith($this.data("productid") + ":")) {
  231. params.splice(i, 1);
  232. break;
  233. }
  234. }
  235. }
  236. });
  237. $(".sort-input").change(function(){
  238. $this=$(this);
  239. // 控制input只能输入数字
  240. $this.val($this.val().replace(/[^\d]/g, ""));
  241. if (typeof($this.val()) == "number" && $this.val() <= 1 || $this.val() == '')
  242. $this.val(1);
  243. var data = $this.data("productid") + ":" + $this.val();
  244. var flag = true;
  245. for (var i = 0; i < params.length; i++) {
  246. if (params[i].startsWith($this.data("productid") + ":")) {
  247. params.splice(i, 1);
  248. params.push(data);
  249. flag = false;
  250. break;
  251. }
  252. }
  253. if (flag) params.push(data);
  254. $this.parent().next().find("input[name='recommendProductID']").attr("checked","true");
  255. });
  256. });
  257. // 初始化
  258. /* var currentTinytype = ${product.tinyTypeID};
  259. var currentSmalltype, currentBigType;
  260. // 初始分类
  261. function loadInitType(){
  262. for(var i=0; i<tinytypeList.length; i++){
  263. if (currentTinytype == tinytypeList[i].tinyTypeID) {
  264. currentSmalltype = tinytypeList[i].smallTypeID;
  265. }
  266. }
  267. for(var i=0; i<smalltypeList.length; i++){
  268. if (currentSmalltype == smalltypeList[i].smallTypeID) {
  269. currentBigType = smalltypeList[i].bigTypeID;
  270. }
  271. }
  272. if(currentBigType != null && typeof(currentBigType) != "undefined"){
  273. loadSmallType(currentBigType, '#bigType', '#smallType', '#tinyType');
  274. setTimeout(function(){
  275. loadTinyType(currentSmalltype, '#smallType', '#tinyType');
  276. },0);
  277. setTimeout(function(){
  278. $('#tinyType').val(currentTinytype);
  279. var tinyTypeText = $('#tinyType').find('option:selected').text();
  280. $('#tinyType').prev().find('.select2-chosen').text(tinyTypeText);
  281. },500)
  282. }
  283. }*/
  284. // 网站分类
  285. var currentBigtype = ${product.bigTypeID};
  286. var currentSmalltype = ${product.smallTypeID};
  287. var currentTinytype = ${product.tinyTypeID};
  288. var currentCommodityType = ${product.commodityType}; //商品属性
  289. var bigTypeList = [
  290. <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
  291. <c:if test="${index.index > 0}">,</c:if>
  292. {
  293. bigTypeID: ${bigType.bigTypeID},
  294. name: "${bigType.name}",
  295. typeSort: ${bigType.typeSort}
  296. }
  297. </c:forEach>
  298. ];
  299. var smalltypeList = [
  300. <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
  301. <c:if test="${index.index > 0}">,</c:if>
  302. {
  303. smallTypeID: ${smalltype.smallTypeID},
  304. name: "${smalltype.name}",
  305. bigTypeID: ${smalltype.bigTypeID},
  306. }
  307. </c:forEach>
  308. ];
  309. var tinytypeList = [
  310. <c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
  311. <c:if test="${index.index > 0}">,</c:if>
  312. {
  313. tinyTypeID: ${tinytype.tinyTypeID},
  314. name: "${tinytype.name}",
  315. smallTypeID: ${tinytype.smallTypeID}
  316. }
  317. </c:forEach>
  318. ];
  319. // 初始分类
  320. function loadInitType(){
  321. if (currentCommodityType == null || typeof (currentCommodityType) == "undefined" || currentCommodityType == '0') {
  322. $("#bigType").html("");
  323. $("#bigType").prev().find(".select2-chosen").text("请选择");
  324. $("#bigType").append("<option value=''>请选择</option>");
  325. $("#smallType").html("");
  326. $("#smallType").prev().find(".select2-chosen").text("请选择");
  327. $("#smallType").append("<option value=''>请选择</option>");
  328. $("#tinyType").html("");
  329. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  330. $("#tinyType").append("<option value=''>请选择</option>");
  331. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  332. }else if(currentBigtype != null && typeof(currentBigtype) != "undefined"){
  333. setTimeout(function(){
  334. loadBigType();
  335. },0);
  336. }
  337. }
  338. // 分类联动
  339. function loadBigType(){
  340. var commodityType = $("#commodityType").val();
  341. $("#bigType").html("");
  342. $("#bigType").prev().find(".select2-chosen").text("请选择");
  343. $("#bigType").append("<option value=''>请选择</option>");
  344. $("#smallType").html("");
  345. $("#smallType").prev().find(".select2-chosen").text("请选择");
  346. $("#smallType").append("<option value=''>请选择</option>");
  347. $("#tinyType").html("");
  348. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  349. $("#tinyType").append("<option value=''>请选择</option>");
  350. if(typeof(commodityType) != "undefined") {
  351. $("#bigType").html("");
  352. $("#bigType").prev().find(".select2-chosen").text("请选择");
  353. $("#bigType").append("<option value=''>请选择</option>");
  354. $("#smallType").html("");
  355. $("#smallType").prev().find(".select2-chosen").text("请选择");
  356. $("#smallType").append("<option value=''>请选择</option>");
  357. $("#tinyType").html("");
  358. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  359. $("#tinyType").append("<option value=''>请选择</option>");
  360. for(var i=0; i<bigTypeList.length; i++){
  361. if (commodityType == bigTypeList[i].typeSort) {
  362. if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeID) {
  363. $("#bigType").append("<option selected value='"+bigTypeList[i].bigTypeID+"'>"+bigTypeList[i].name+"</option>");
  364. $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
  365. setTimeout(function(){
  366. loadSmallType();
  367. },500);
  368. }else{
  369. $("#bigType").append("<option value='"+bigTypeList[i].bigTypeID+"'>"+bigTypeList[i].name+"</option>");
  370. }
  371. }
  372. }
  373. }
  374. loadSmallType();
  375. }
  376. function loadSmallType(id){
  377. if(id){
  378. $("#bigType").val(id);
  379. $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
  380. }
  381. var bigType = $("#bigType").val();
  382. $("#smallType").html("");
  383. $("#smallType").prev().find(".select2-chosen").text("请选择");
  384. $("#smallType").append("<option value=''>请选择</option>");
  385. $("#tinyType").html("");
  386. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  387. $("#tinyType").append("<option value=''>请选择</option>");
  388. if(typeof(bigType) != "undefined" && bigType != "") {
  389. var smallTypeNum = 0;
  390. for(var i=0; i<smalltypeList.length; i++){
  391. if (bigType == smalltypeList[i].bigTypeID) {
  392. smallTypeNum = smallTypeNum + 1;
  393. if(currentSmalltype != null && typeof(currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
  394. $("#smallType").append("<option selected value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
  395. $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
  396. setTimeout(function(){
  397. loadTinyType(currentSmalltype);
  398. },500);
  399. }else{
  400. $("#smallType").append("<option value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
  401. }
  402. }
  403. }
  404. if (smallTypeNum == 0) {
  405. $("#smallType").removeClass("required");
  406. document.getElementById("s2id_smallType").style.cssText = "display: none";
  407. }else {
  408. $("#smallType").addClass("required");
  409. document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
  410. }
  411. } else {
  412. $("#smallType").removeClass("required");
  413. document.getElementById("s2id_smallType").style.cssText = "display: none";
  414. }
  415. loadTinyType();
  416. }
  417. function loadTinyType(id) {
  418. if(id){
  419. $("#smallType").val(id);
  420. $("#smallType").prev().find(".select2-chosen").text($("#smallType option:selected").text());
  421. }
  422. var smallType = $("#smallType option:selected").val();
  423. $("#tinyType").html("");
  424. $("#tinyType").prev().find(".select2-chosen").text("请选择");
  425. $("#tinyType").append("<option value=''>请选择</option>");
  426. if(typeof(smallType) != "undefined" && smallType != "") {
  427. var tinyTypeNum = 0;
  428. for(var i=0; i<tinytypeList.length; i++){
  429. if (smallType == tinytypeList[i].smallTypeID) {
  430. tinyTypeNum = tinyTypeNum + 1;
  431. if(currentTinytype != null && typeof(currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
  432. $("#tinyType").append("<option selected value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
  433. $("#tinyType").prev().find(".select2-chosen").text(tinytypeList[i].name);
  434. }else{
  435. $("#tinyType").append("<option value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
  436. }
  437. }
  438. }
  439. if (tinyTypeNum == 0) {
  440. $("#tinyType").removeClass("required");
  441. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  442. }else {
  443. $("#tinyType").addClass("required");
  444. document.getElementById("s2id_tinyType").style.cssText = "display: inline-block";
  445. }
  446. } else {
  447. document.getElementById("s2id_tinyType").style.cssText = "display: none";
  448. $("#tinyType").removeClass("required");
  449. }
  450. }
  451. /*function loadSmallType(id, big, small, tiny){
  452. if(id){
  453. $(big).val(id);
  454. var text = $(big).find('option:selected').text();
  455. $(big).prev().find(".select2-chosen").text(text);
  456. }
  457. var bigType = $(big).val();
  458. if(typeof(bigType) != "undefined") {
  459. $(small).html("");
  460. $(small).prev().find(".select2-chosen").text("请选择");
  461. $(small).append("<option value=''>请选择</option>");
  462. $(tiny).html("");
  463. $(tiny).prev().find(".select2-chosen").text("请选择");
  464. $(tiny).append("<option value=''>请选择</option>");
  465. for(var i=0; i<smalltypeList.length; i++){
  466. if (bigType == smalltypeList[i].bigTypeID) {
  467. if(currentSmalltype != null && typeof(currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
  468. $(small).append("<option selected value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
  469. $(small).prev().find(".select2-chosen").text(smalltypeList[i].name);
  470. setTimeout(function(){
  471. loadTinyType(currentSmalltype, small, tiny)
  472. },i*500);
  473. }else{
  474. $(small).append("<option value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
  475. }
  476. }
  477. }
  478. } else {
  479. $(small).html("");
  480. $(small).prev().find(".select2-chosen").text("请选择");
  481. $(small).append("<option value=''>请选择</option>");
  482. $(tiny).html("");
  483. $(tiny).prev().find(".select2-chosen").text("请选择");
  484. $(tiny).append("<option value=''>请选择</option>");
  485. }
  486. }*/
  487. /*function loadTinyType(id, small, tiny){
  488. if(id){
  489. $(small).val(id);
  490. var text = $(small).find('option:selected').text();
  491. $(small).prev().find(".select2-chosen").text(text);
  492. }
  493. var smallType = $(small).find('option:selected').val();
  494. if(typeof(smallType) != "undefined") {
  495. $(tiny).html("");
  496. $(tiny).prev().find(".select2-chosen").text("请选择");
  497. $(tiny).append("<option value=''>请选择</option>");
  498. for(var i=0; i<tinytypeList.length; i++){
  499. if (smallType == tinytypeList[i].smallTypeID) {
  500. if(currentTinytype != null && typeof(currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
  501. $(tiny).append("<option selected value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
  502. $(tiny).prev().find(".select2-chosen").text(tinytypeList[i].name);
  503. }else{
  504. $(tiny).append("<option value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
  505. }
  506. }
  507. }
  508. } else {
  509. $(tiny).html("");
  510. $(tiny).prev().find(".select2-chosen").text("请选择");
  511. $(tiny).append("<option value=''>请选择</option>");
  512. }
  513. }*/
  514. function changeRecommendType(){
  515. var recommendType = $("input[name='recommendType']:checked").val();
  516. if (recommendType == '0') {
  517. $('#p-list').hide();
  518. } else if (recommendType == '1') {
  519. $('#p-list').show();
  520. }
  521. }
  522. </script>
  523. </body>
  524. </html>