subject_index.tpl 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. {include file="public/header-begin" /}
  2. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/datapicker/datepicker3.css">
  3. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/chosen/chosen.css">
  4. <link rel="stylesheet" href="/static/admin/css/style.min.css?v=4.0.0">
  5. <script src="{$Think.config.resources}/static/common/js/vue.js"></script>
  6. {include file="public/header-end" /}
  7. <div class="wrapper wrapper-content">
  8. <div id="vue" class="row">
  9. <div class="col-sm-12 animated fadeInRight">
  10. <div class="mail-box-header">
  11. <h2>
  12. 标的列表 (第{{(pc.p + 10)/10}}页 / {$count}条 共)
  13. </h2>
  14. <div class="mail-tools tooltip-demo m-t-md">
  15. <div class="btn-group pull-right">
  16. <table class="zq_search">
  17. <tr>
  18. <td>
  19. <div class="input-group" style="width:200px">
  20. <input id="area" data-id="0" type="text" class="form-control input-sm" value="地区不限" style="font-size:12px;" v-el:area>
  21. <div class="input-group-btn">
  22. <button type="button" class="btn btn-white dropdown-toggle btn-sm" data-toggle="dropdown">
  23. <span class="caret"></span>
  24. </button>
  25. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  26. </ul>
  27. </div>
  28. </div>
  29. </td>
  30. <td>
  31. <select id="type" data-placeholder="选择类别" class="chosen-select" style="width:150px;" v-model="cn.typeid" v-el:type>
  32. <option value="0" hassubinfo="true" selected>所有分类</option>
  33. {foreach name="type" item="item"}
  34. <option value="{$item.id}" hassubinfo="true" >{$item.title}</option>
  35. {/foreach}
  36. </select>
  37. </td>
  38. <td>
  39. <div class="input-daterange input-group" datepicker="datepicker">
  40. <input v-model="cn.begintime" type="text" class="input-sm form-control" name="starttime" value="" style="width:100px"/>
  41. <span class="input-group-addon">到</span>
  42. <input v-model="cn.endtime" type="text" class="input-sm form-control" name="endtime" value="" style="width:100px"/>
  43. </div>
  44. <td>
  45. <button @click="search" type="button" class="btn btn-sm btn-primary">搜索</button>
  46. </td>
  47. </tr>
  48. </table>
  49. </div>
  50. <button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left" title="刷新"><i class="fa fa-refresh"></i> 刷新</button>
  51. <button @click="status" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="展示">展示
  52. </button>
  53. <button @click="level" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="推荐">推荐
  54. </button>
  55. <button @click="del" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="删除">删除
  56. </button>
  57. <button class="btn btn-white btn-sm" @click="page(-1)"><i class="fa fa-arrow-left"></i>
  58. </button>
  59. <button class="btn btn-white btn-sm" @click="page(1)"><i class="fa fa-arrow-right"></i>
  60. </button>
  61. </div>
  62. </div>
  63. <div class="mail-box">
  64. <table class="table table-hover table-mail">
  65. <tbody>
  66. <tr class="read" v-for="item in items">
  67. <td class="check-mail">
  68. <input type="checkbox" class="i-checks" value="{{item.id}}" v-model="ids">
  69. </td>
  70. <td class="mail-ontact">
  71. <a href="mail_detail.html">{{item.areatext}}</a>
  72. <span v-show="!item.status" class="label label-danger pull-right" style="margin-left:5px;">下架</span>
  73. <span v-show="item.level" class="label label-warning pull-right">推荐</span>
  74. </td>
  75. <td class="mail-subject">
  76. <a target="_blank" href="{:url('index/product/detail')}/?id={{item.id}}">{{item.title}}</a>
  77. <span style="color:#cccccc;">[{{item.typetext}}]</span>
  78. </td>
  79. <td class="">
  80. <a href="{:url('edit')}/?id={{item.id}}">[详细]</a>
  81. </td>
  82. <td class="text-right mail-date">{{item.edittime}}</td>
  83. </tr>
  84. </tbody>
  85. </table>
  86. <table class="table table-mail" v-show="nodata">
  87. <tbody>
  88. <td height="250" align="center" valign="middle">
  89. <h1>:( 没有数据,修改搜索条件试试!</h1>
  90. </td>
  91. </tbody>
  92. </table>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. {include file="public/footer-js" /}
  98. <script>
  99. Vue.filter('reverse', function (value) {
  100. return value.join(',')
  101. });
  102. new Vue({
  103. el: '#vue',
  104. data: {
  105. items: [
  106. {
  107. id: 1,
  108. title: '包车一日游',
  109. typetext: '一日游',
  110. areatext: '北京',
  111. edittime: '昨天 12 点',
  112. }
  113. ],
  114. ids :[],
  115. cn: {
  116. areaid:1,
  117. typeid:2,
  118. begintime:'',
  119. endtime:'',
  120. },
  121. pc: {
  122. p:{$pc.p},
  123. c:{$pc.c},
  124. },
  125. },
  126. methods: {
  127. status: function() {
  128. if(this.ids.length == 0) {
  129. swal({
  130. title: '哎呀',
  131. text: '没有选择任何条目',
  132. })
  133. return
  134. }
  135. var that = this;
  136. var reverse = Vue.filter('reverse');
  137. var status = [];
  138. for(item of that.items) {
  139. for (var i = 0; i < this.ids.length; i++) {
  140. if (this.ids[i] == item.id) {
  141. status.push(item.status);
  142. }
  143. }
  144. }
  145. //console.log(status);
  146. $.ajax({
  147. url: '{:url('status')}',
  148. data: {
  149. cn:this.cnCreate(),
  150. id:reverse(that.ids),
  151. p:this.pc.p,
  152. status:reverse(status),
  153. },
  154. success: function(data) {
  155. that.items = data.content;
  156. swal({
  157. title: data.msg,
  158. type: "success"
  159. },function () {
  160. //window.location.href = data.forward;
  161. that.ids = [];
  162. })
  163. }
  164. });
  165. },
  166. level: function() {
  167. if(this.ids.length == 0) {
  168. swal({
  169. title: '哎呀',
  170. text: '没有选择任何条目',
  171. })
  172. return
  173. }
  174. var that = this;
  175. var reverse = Vue.filter('reverse');
  176. var level = [];
  177. for(item of that.items) {
  178. for (var i = 0; i < this.ids.length; i++) {
  179. if (this.ids[i] == item.id) {
  180. level.push(item.level);
  181. }
  182. }
  183. }
  184. //console.log(status);
  185. $.ajax({
  186. url: '{:url('level')}',
  187. data: {
  188. cn:this.cnCreate(),
  189. id:reverse(that.ids),
  190. p:this.pc.p,
  191. level:reverse(level),
  192. },
  193. success: function(data) {
  194. that.items = data.content;
  195. swal({
  196. title: data.msg,
  197. type: "success"
  198. },function () {
  199. //window.location.href = data.forward;
  200. that.ids = [];
  201. })
  202. }
  203. });
  204. },
  205. del: function () {
  206. if(this.ids.length == 0) {
  207. swal({
  208. title: '哎呀',
  209. text: '没有选择任何条目',
  210. })
  211. return
  212. }
  213. var that = this;
  214. var reverse = Vue.filter('reverse');
  215. swal({
  216. title: "您确定要删除这条信息吗",
  217. text: "删除后将无法恢复,请谨慎操作!",
  218. type: "warning",
  219. showCancelButton: true,
  220. confirmButtonColor: "#DD6B55",
  221. confirmButtonText: "删除",
  222. cancelButtonText: "取消",
  223. closeOnConfirm: false
  224. },
  225. function() {
  226. $.ajax({
  227. url: '{:url('del')}',
  228. data: {
  229. cn:that.cnCreate(),
  230. p:that.pc.p,
  231. id:reverse(that.ids),
  232. },
  233. success: function(data) {
  234. that.items = data.content;
  235. swal({
  236. title: data.msg,
  237. type: "success"
  238. },function () {
  239. //window.location.href = data.forward;
  240. that.ids = [];
  241. })
  242. }
  243. });
  244. })
  245. },
  246. page:function(c) {
  247. if(this.pc.p == 0 && c < 0) {
  248. return;
  249. }
  250. this.pc.p += c * this.pc.c;
  251. var that = this;
  252. $.ajax({
  253. url: '{:url('index')}',
  254. data: {
  255. cn:this.cnCreate(),
  256. p:this.pc.p,
  257. },
  258. success: function(data) {
  259. if(data.code == 1) {
  260. if(data.content.length == 0) {
  261. swal({
  262. title: '哎呀',
  263. text: '没有数据了',
  264. })
  265. that.pc.p -= that.pc.c;
  266. return;
  267. }
  268. that.items = data.content;
  269. }
  270. }
  271. });
  272. },
  273. search:function() {
  274. //有些非标准组件无法进行双向绑定;this.$els.area是需要在节点设置的
  275. var that = this;
  276. $.ajax({
  277. url: '{:url('index')}',
  278. data: {
  279. cn:this.cnCreate(),
  280. p:this.pc.p,
  281. },
  282. success: function(data) {
  283. if(data.code == 1) {
  284. that.items = data.content;
  285. }
  286. }
  287. });
  288. },
  289. cnCreate:function() {
  290. this.cn.areaid = $(this.$els.area).attr('data-id');
  291. this.cn.typeid = $(this.$els.type).val();
  292. var json = Vue.filter('json');
  293. return json.read(this.cn);
  294. }
  295. },
  296. ready : function () {
  297. var that = this;
  298. $.getJSON('{:url('index')}',function(data) {
  299. if(data.code == 1) {
  300. that.items = data.content;
  301. }
  302. });
  303. },
  304. computed : {
  305. nodata:function(){
  306. return this.items.length == 0 ? true : false;
  307. }
  308. }
  309. })
  310. </script>
  311. <script src="{$Think.config.base_url}/static/admin/js/plugins/datapicker/bootstrap-datepicker.js"></script>
  312. <script>
  313. //日期
  314. $("div[datepicker='datepicker']").datepicker({
  315. keyboardNavigation: !1,
  316. forceParse: !1,
  317. autoclose: !0
  318. });
  319. </script>
  320. <script src="{$Think.config.base_url}/static/admin/js/plugins/suggest/bootstrap-suggest.min.js"></script>
  321. <script>
  322. var testdataBsSuggest = $("#area").bsSuggest({
  323. indexId: 0,
  324. indexKey: 1,
  325. getDataMethod: "url",
  326. effectiveFieldsAlias: {
  327. id: "编号",
  328. keyword: "地区",
  329. },
  330. showHeader: true,
  331. data: {
  332. "value": [{
  333. "id": "0",
  334. "keyword": "lzw",
  335. },
  336. {
  337. "id": "1",
  338. "keyword": "lzwme",
  339. },
  340. {
  341. "id": "2",
  342. "keyword": "meizu",
  343. },
  344. {
  345. "id": "3",
  346. "keyword": "flyme",
  347. }],
  348. "defaults": "http://lzw.me"
  349. },
  350. url: "{:url('product/getPos')}" + "/keyword/",
  351. processData: function(json) {
  352. var i, len, data = {
  353. value: []
  354. };
  355. if (json.code!=1) {
  356. return;
  357. }
  358. len = json.content.length;
  359. data.value.push({
  360. "id": 0,
  361. "keyword": "地区不限",
  362. })
  363. for (i = 0; i < len; i++) {
  364. data.value.push({
  365. "id": json.content[i][0],
  366. "keyword": json.content[i][1],
  367. })
  368. }
  369. return data;
  370. }
  371. });
  372. </script>
  373. <style>
  374. .chosen-container-single .chosen-single { padding-top: 3px;padding-bottom: 0;padding-left:10px;}
  375. .chosen-container-single .chosen-single div b { background-position: 0px 4px; }
  376. .chosen-container-active.chosen-with-drop .chosen-single div b { background-position-y:4px; }
  377. </style>
  378. <script src="{$Think.config.base_url}/static/admin/js/plugins/datapicker/bootstrap-datepicker.js"></script>
  379. <script src="{$Think.config.base_url}/static/admin/js/plugins/chosen/chosen.jquery.js"></script>
  380. <script>
  381. //日期
  382. $("div[datepicker='datepicker']").datepicker({
  383. keyboardNavigation: !1,
  384. forceParse: !1,
  385. autoclose: !0
  386. });
  387. $("#type").chosen({
  388. no_results_text: "没有找到!",
  389. allow_single_deselect: !0
  390. });
  391. </script>
  392. {include file="public/footer" /}