goods_selector_js.html 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <div class="goods-selector" id="goods_selector_goods_selector" data-switch="1">
  2. <!--modal-->
  3. <div class="modal fade ">
  4. <div class="modal-dialog">
  5. <div class="modal-header">
  6. <button type="button" class="close" onclick="$(this).parents('#goods_selector_goods_selector').remove()">
  7. <span>×</span>
  8. </button>
  9. <h3 class="modal-title">数据选择器</h3>
  10. </div>
  11. <div class="modal-body">
  12. <div class="row" style="padding:15px 0;">
  13. <div class="input-group fenlei">
  14. <span class="input-group-select">
  15. <!--商品分类-->
  16. <select name="goodsgroup" class="select2" style="width:275px;" id="cates">
  17. <option value="0">选择商品分类</option>
  18. </select>
  19. </span>
  20. <input type="text" class="form-control search" placeholder="请输入关键字">
  21. <span class="input-group-btn">
  22. <button type="button" class="btn btn-default pager-nav" page="1">搜索</button>
  23. </span>
  24. </div>
  25. </div>
  26. <!--描述文字-->
  27. <!--分页列表-->
  28. <div class="content"></div>
  29. </div>
  30. <div class="modal-footer"><a href="#" class="btn btn-default" onclick="$(this).parents('#goods_selector_goods_selector').remove()">关闭</a></div>
  31. <!--商品分类-->
  32. <!--<div class="select2-drop select2-display-none select2-with-searchbox select2-drop-active" style="left: 30px; width: 275px; top: 95px; bottom: auto; display: none;" id="select2-drop">-->
  33. <!--<ul class="select2-results" role="listbox" id="select2-results-2">-->
  34. <!--<li class="select2-results-dept-0 select2-result select2-result-selectable select2-highlighted" role="presentation">-->
  35. <!--<div class="select2-result-label" id="select2-result-label-41" role="option" data-id="0">-->
  36. <!--<span class="select2-match"></span>商品分类-->
  37. <!--</div>-->
  38. <!--</li>-->
  39. <!--<li class="select2-results-dept-0 select2-result select2-result-selectable" role="presentation">-->
  40. <!--<div class="select2-result-label" id="select2-result-label-42" role="option" data-id="12">-->
  41. <!--<span class="select2-match"></span>家用电器-->
  42. <!--</div>-->
  43. <!--</li>-->
  44. <!--</ul>-->
  45. <!--</div>-->
  46. </div>
  47. </div>
  48. </div>
  49. <style>
  50. .cancelit{
  51. background-color: red;
  52. }
  53. .page-raduis{
  54. border-top-right-radius: 4px;border-bottom-right-radius: 4px;
  55. }
  56. .goods-selector{
  57. width: 100%;
  58. float: left;
  59. }
  60. .goods-selector-header{
  61. width: 100%;height: 3rem;line-height: 3rem;border-color: #efefef;
  62. background: #f6f6f6;border: 1px solid #f2f2f2;float: left;
  63. }
  64. .goods-selector-content{
  65. margin-top: 5px;
  66. width: 100%;line-height: 3rem;border-color: #efefef;
  67. border: 1px solid #f2f2f2;float: left;
  68. }
  69. #mask{
  70. z-index: 2060 !important;
  71. position: fixed;
  72. top: 0;
  73. right: 0;
  74. bottom: 0;
  75. left: 0;
  76. display: none;
  77. overflow: hidden;
  78. -webkit-overflow-scrolling: touch;
  79. outline: 0;
  80. background-color: rgba(0,0,0,0.5);
  81. -webkit-transition: opacity .15s linear;
  82. -o-transition: opacity .15s linear;
  83. transition: opacity .15s linear;
  84. }
  85. .goods-selector .modal{
  86. z-index: 2060 !important;
  87. position: fixed;
  88. top: 0;
  89. right: 0;
  90. bottom: 0;
  91. left: 0;
  92. display: none;
  93. overflow: hidden;
  94. -webkit-overflow-scrolling: touch;
  95. outline: 0;
  96. background-color: rgba(0,0,0,0.5);
  97. -webkit-transition: opacity .15s linear;
  98. -o-transition: opacity .15s linear;
  99. transition: opacity .15s linear;
  100. }
  101. .goods-selector .modal-dialog{
  102. height: 704px;
  103. width: 920px;
  104. background-color: #fff;
  105. position: absolute;
  106. left: 50%;
  107. margin-left: -460px;
  108. z-index: 2061 !important;
  109. display: block;
  110. }
  111. .goods-selector .modal .modal-header{
  112. background-color: #f4f5f9;
  113. border-bottom: 0;
  114. padding: 15px 20px;
  115. }
  116. .goods-selector .modal .modal-header h3 {
  117. font-size: 14px;
  118. }
  119. .goods-selector .modal .modal-header .close{
  120. -webkit-appearance: none;
  121. padding: 0;
  122. cursor: pointer;
  123. background: 0 0;
  124. border: 0;
  125. float: right;
  126. font-size: 21px;
  127. font-weight: 700;
  128. line-height: 1;
  129. color: #000;
  130. text-shadow: 0 1px 0 #fff;
  131. filter: alpha(opacity=20);
  132. opacity: .2;
  133. }
  134. .goods-selector .modal .modal-body {
  135. padding: 0 30px;
  136. overflow-y: auto;
  137. overflow-x: hidden;
  138. height: 595px;
  139. }
  140. .goods-selector .modal .modal-body .row {
  141. margin-right: -10px;
  142. margin-left: -10px;
  143. }
  144. .goods-selector .modal .modal-body .input-group {
  145. position: relative;
  146. border-collapse: separate;
  147. overflow: hidden;
  148. margin-left: 10px;
  149. }
  150. .goods-selector .modal .modal-body .input-group .form-control::-webkit-input-placeholder {
  151. color:#999;
  152. }
  153. .goods-selector .modal .modal-body .input-group .form-control {
  154. position: relative;
  155. z-index: 2;
  156. float: left;
  157. width: 530px;
  158. margin-bottom: 0;
  159. background-color: #FFFFFF;
  160. background-image: none;
  161. border: 1px solid #efefef;
  162. border-radius: 1px;
  163. color: inherit;
  164. display: block;
  165. -webkit-transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
  166. transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
  167. font-size: 12px;
  168. height: 30px;
  169. }
  170. .goods-selector .modal .modal-body .input-group .input-group-btn{
  171. display: inline-block;
  172. }
  173. .goods-selector .modal .modal-body .input-group .btn {
  174. border-radius: 1px;
  175. font-size: 12px;
  176. height: 30px;
  177. float: left;
  178. width: 58px
  179. }
  180. .goods-selector .modal .modal-body .table{
  181. font-size: 12px;
  182. color: #333;
  183. margin-bottom: 0;
  184. }
  185. .goods-selector .modal .modal-body .table tr td:last-child{
  186. padding-right: 42px;
  187. width: 140px;
  188. position: relative;
  189. }
  190. .goods-selector .modal .modal-body .table tr td:first-child{
  191. text-align: left;
  192. width: auto;
  193. padding-left: 8px;
  194. padding-right: 40px
  195. }
  196. .goods-selector .modal .modal-body .table td{
  197. padding: 8px 50px 8px 0;
  198. text-align: right;
  199. border-top: 0;
  200. width: 112px;
  201. overflow: hidden;
  202. text-overflow: ellipsis;
  203. white-space: nowrap;
  204. }
  205. .goods-selector .modal .modal-body .table thead{
  206. background: #f7f7f7
  207. }
  208. .goods-selector .modal .modal-body .table tbody tr td{
  209. border-bottom: 1px solid #ededed;
  210. height: 47px;
  211. vertical-align: middle;
  212. }
  213. .goods-selector .modal .modal-body .table tbody tr td:first-child{
  214. border-left: 1px solid #ededed;
  215. line-height: 30px;
  216. }
  217. .goods-selector .modal .modal-body .table tbody tr td:last-child:after{
  218. content: " ";
  219. position: absolute;
  220. right: 0;
  221. top: 0;
  222. width: 1px;
  223. height: 100%;
  224. border-right: 1px solid #ebebeb;
  225. }
  226. .goods-selector .modal .modal-body .pagination{
  227. float: right;
  228. margin-left:10px;
  229. }
  230. .goods-selector .modal .modal-body .record{
  231. display:inline-block;
  232. float:right;
  233. line-height: 28px;
  234. margin: 20px 0
  235. }
  236. .goods-selector .modal .modal-body .pagination>li {
  237. display: inline;
  238. }
  239. .pagination>li a{
  240. position: relative;
  241. float: left;
  242. margin-left: -1px;
  243. text-decoration: none;
  244. border: 1px solid #ddd;
  245. }
  246. .pagination>li input{
  247. width: 44px;
  248. height:28px;
  249. position: relative;
  250. float: left;
  251. margin-left: -1px;
  252. text-decoration: none;
  253. border: 1px solid #ddd;
  254. margin-right: 5px;
  255. color: #000;
  256. line-height: 12px;
  257. font-size: 12px;
  258. padding: 7px 10px;
  259. }
  260. .pagination>li>a:focus, .pagination>li>a:hover {
  261. z-index: 2;
  262. color: #23527c;
  263. background-color: #eee;
  264. border-color: #ddd;
  265. }
  266. .goods-selector .modal .btn-default {
  267. background: #fdfdfd !important;
  268. color: #666;
  269. border: 1px solid #efefef !important;
  270. outline: none;
  271. }
  272. .goods-selector .modal .modal-footer {
  273. background-color: #f4f5f9;
  274. border-top: 0;
  275. text-align: center;
  276. padding: 15px;
  277. }
  278. .goods-selector .modal .modal-footer .btn {
  279. display: inline-block;
  280. min-width: 105px;
  281. }
  282. .goods-selector .form-control.select2-container .select2-choice {
  283. outline: 0;
  284. }
  285. </style>
  286. <script>
  287. model.init();
  288. $.ajax({
  289. url:"{php echo $_W['plugin']=='merch'? './merchant.php?c=site&a=entry&m=lionfish_comshop&do=admin&controller=goods.getcate': './index.php?c=site&a=entry&m=lionfish_comshop&do=admin&controller=util.goods_selector.getcate'}",
  290. type:'get',
  291. success:function (json) {
  292. console.log(json)
  293. var htm = '<option value="0">选择商品分类</option>';
  294. $('.fenlei select').html(htm);
  295. $.each(json,function (i,v) {
  296. $('.fenlei select').append('<option value="'+v.id+'">'+v.name+'</option>');
  297. });
  298. myrequire(['select2'],function (select2) {
  299. $('#cates').select2()
  300. })
  301. }
  302. });
  303. </script>