order_index.tpl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. {include file="public/header-begin" /}
  2. <link rel="stylesheet" href="{$Think.config.base_url}/static/admin/css/plugins/datapicker/datepicker3.css">
  3. <link rel="stylesheet" href="{$Think.config.base_url}/static/admin/css/plugins/chosen/chosen.css">
  4. <link rel="stylesheet" href="{$Think.config.base_url}/static/admin/css/style.min.css?v=4.0.0">
  5. <script src="{$Think.config.base_url}/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. 订单列表 (第{{page.begin}}页 / {{page.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="user" data-id="0" type="text" class="form-control input-sm" value="" style="font-size:12px;" v-el:user>
  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. <div class="input-group" style="width:200px">
  32. <input id="area" data-id="0" type="text" class="form-control input-sm" value="地区不限" style="font-size:12px;" v-el:area>
  33. <div class="input-group-btn">
  34. <button type="button" class="btn btn-white dropdown-toggle btn-sm" data-toggle="dropdown">
  35. <span class="caret"></span>
  36. </button>
  37. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  38. </ul>
  39. </div>
  40. </div>
  41. </td>
  42. <td>
  43. <select id="ptype" data-placeholder="选择类别" class="chosen-select" style="width:150px;" v-model="cn.ptype" v-el:ptype>
  44. <option value="0" hassubinfo="true" selected>所有分类</option>
  45. {foreach name="ptype" item="item" key="k"}
  46. <option value="{$k}" hassubinfo="true" >{$item}</option>
  47. {/foreach}
  48. </select>
  49. </td>
  50. <td>
  51. <div class="input-daterange input-group" datepicker="datepicker">
  52. <input v-model="cn.begintime" type="text" class="input-sm form-control" name="starttime" value="" style="width:100px"/>
  53. <span class="input-group-addon">到</span>
  54. <input v-model="cn.endtime" type="text" class="input-sm form-control" name="endtime" value="" style="width:100px"/>
  55. </div>
  56. <td>
  57. <button @click="search" type="button" class="btn btn-sm btn-primary">搜索</button>
  58. </td>
  59. </tr>
  60. </table>
  61. </div>
  62. <button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left" title="刷新"><i class="fa fa-refresh"></i> 刷新</button>
  63. <button @click="status" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="展示">展示
  64. </button>
  65. <button @click="level" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="推荐">推荐
  66. </button>
  67. <button @click="del" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="删除">删除
  68. </button>
  69. <button class="btn btn-white btn-sm" @click="page(-1)"><i class="fa fa-arrow-left"></i>
  70. </button>
  71. <button class="btn btn-white btn-sm" @click="page(1)"><i class="fa fa-arrow-right"></i>
  72. </button>
  73. </div>
  74. </div>
  75. <div class="mail-box" style="position: relative;">
  76. <table class="table table-hover table-mail">
  77. <tbody>
  78. <tr class="read" v-for="item in items">
  79. <td class="check-mail">
  80. <input type="checkbox" class="i-checks" value="{{item.id}}" v-model="ids">
  81. </td>
  82. <td>
  83. <span>{{item.ordernumber}}</span>
  84. </td>
  85. <td>
  86. <span>{{item.partner_name}}</span>
  87. </td>
  88. <td>
  89. <a>{{item.areatext}}</a>
  90. <span class="label {{item.order_status | statusFilter}} pull-right" style="margin-left:5px;">{{item._order_status}}</span>
  91. <span class="label label-warning pull-right">{{item.statustext}}</span>
  92. </td>
  93. <td class="mail-subject">
  94. <a target="_blank" href="{:url('index/product/detail')}/?id={{item.pid}}">[{{item.ptypetext}}]</a>
  95. <a target="_blank" href="{:url('index/product/detail')}/?id={{item.pid}}">{{item.title}}</a>
  96. <span v-if="item.ptype == 1"><span style="color:#1ab394">{{item.from_name}}</span> -> {{item.to_name}}</span>
  97. <span v-if="item.ptype == 2">{{item.from_name}} -> <span style="color:#1ab394">{{item.to_name}}</span></span>
  98. </td>
  99. <td class="">
  100. <a href="{:url('detail')}/?id={{item.id}}">[详细]</a>
  101. </td>
  102. <td class="text-right mail-date"> {{item.addtime}}</td>
  103. </tr>
  104. </tbody>
  105. </table>
  106. <table class="table table-mail" v-show="nodata">
  107. <tbody>
  108. <td height="250" align="center" valign="middle">
  109. <h1>:( 没有数据,修改搜索条件试试!</h1>
  110. </td>
  111. </tbody>
  112. </table>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. {include file="public/footer-js" /}
  118. <script>
  119. Vue.filter('reverse', function (value) {
  120. return value.split('').reverse().join('')
  121. })
  122. Vue.filter('statusFilter', function (value) {
  123. switch(value)
  124. {
  125. case 0:
  126. return 'label-info';
  127. case 1:
  128. return 'label-danger';
  129. case 2:
  130. return 'label-danger';
  131. case 3:
  132. return 'label-danger';
  133. case 4:
  134. return 'label-danger';
  135. case 5:
  136. return 'label-danger';
  137. default:
  138. return 'label-danger';
  139. }
  140. });
  141. new Vue({
  142. el: '#vue',
  143. data: {
  144. items: [],
  145. page: {
  146. begin:1,
  147. count:10,
  148. amout:0
  149. },
  150. ids :[],
  151. cn: {
  152. uid:0,
  153. areaid:1,
  154. typeid:2,
  155. begintime:'',
  156. endtime:'',
  157. },
  158. load : false,
  159. },
  160. methods: {
  161. status: function() {
  162. if(this.ids.length == 0) {
  163. swal({
  164. title: '哎呀',
  165. text: '没有选择任何条目',
  166. })
  167. return
  168. }
  169. var that = this;
  170. var reverse = Vue.filter('reverse');
  171. var status = [];
  172. for(item of that.items) {
  173. for (var i = 0; i < this.ids.length; i++) {
  174. if (this.ids[i] == item.id) {
  175. status.push(item.status);
  176. }
  177. }
  178. }
  179. //console.log(status);
  180. $.ajax({
  181. url: '{:url('status')}',
  182. data: {
  183. cn:this.cnCreate(),
  184. id:reverse(that.ids),
  185. p:this.pc.p,
  186. status:reverse(status),
  187. },
  188. success: function(data) {
  189. that.items = data.content;
  190. swal({
  191. title: data.msg,
  192. type: "success"
  193. },function () {
  194. //window.location.href = data.forward;
  195. that.ids = [];
  196. })
  197. }
  198. });
  199. },
  200. level: function() {
  201. if(this.ids.length == 0) {
  202. swal({
  203. title: '哎呀',
  204. text: '没有选择任何条目',
  205. })
  206. return
  207. }
  208. var that = this;
  209. var reverse = Vue.filter('reverse');
  210. var level = [];
  211. for(item of that.items) {
  212. for (var i = 0; i < this.ids.length; i++) {
  213. if (this.ids[i] == item.id) {
  214. level.push(item.level);
  215. }
  216. }
  217. }
  218. //console.log(status);
  219. $.ajax({
  220. url: '{:url('level')}',
  221. data: {
  222. cn:this.cnCreate(),
  223. id:reverse(that.ids),
  224. p:this.pc.p,
  225. level:reverse(level),
  226. },
  227. success: function(data) {
  228. that.items = data.content;
  229. swal({
  230. title: data.msg,
  231. type: "success"
  232. },function () {
  233. //window.location.href = data.forward;
  234. that.ids = [];
  235. })
  236. }
  237. });
  238. },
  239. del: function () {
  240. if(this.ids.length == 0) {
  241. swal({
  242. title: '哎呀',
  243. text: '没有选择任何条目',
  244. })
  245. return
  246. }
  247. var that = this;
  248. var reverse = Vue.filter('reverse');
  249. swal({
  250. title: "您确定要删除这条信息吗",
  251. text: "删除后将无法恢复,请谨慎操作!",
  252. type: "warning",
  253. showCancelButton: true,
  254. confirmButtonColor: "#DD6B55",
  255. confirmButtonText: "删除",
  256. cancelButtonText: "取消",
  257. closeOnConfirm: false
  258. },
  259. function() {
  260. $.ajax({
  261. url: '{:url('del')}',
  262. data: {
  263. cn:that.cnCreate(),
  264. p:that.pc.p,
  265. id:reverse(that.ids),
  266. },
  267. success: function(data) {
  268. that.items = data.content;
  269. swal({
  270. title: data.msg,
  271. type: "success"
  272. },function () {
  273. //window.location.href = data.forward;
  274. that.ids = [];
  275. })
  276. }
  277. });
  278. })
  279. },
  280. page:function(c) {
  281. if(this.pc.p == 0 && c < 0) {
  282. return;
  283. }
  284. this.pc.p += c * this.pc.c;
  285. var that = this;
  286. $.ajax({
  287. url: '{:url('index')}',
  288. data: {
  289. cn:this.cnCreate(),
  290. p:this.pc.p,
  291. },
  292. success: function(data) {
  293. if(data.code == 1) {
  294. if(data.content.length == 0) {
  295. swal({
  296. title: '哎呀',
  297. text: '没有数据了',
  298. })
  299. that.pc.p -= that.pc.c;
  300. return;
  301. }
  302. that.items = data.content;
  303. }
  304. }
  305. });
  306. },
  307. search:function() {
  308. //有些非标准组件无法进行双向绑定;this.$els.area是需要在节点设置的
  309. var that = this;
  310. $.ajax({
  311. url: '{:url('index')}',
  312. data: {
  313. cn:this.cnCreate(),
  314. p:this.pc.p,
  315. },
  316. success: function(data) {
  317. if(data.code == 1) {
  318. that.items = data.content;
  319. }
  320. },
  321. beforeSend : function() {
  322. that.load = true;
  323. },
  324. complete : function() {
  325. that.load = false;
  326. }
  327. });
  328. },
  329. cnCreate:function() {
  330. this.cn.uid = $(this.$els.user).attr('data-id');
  331. this.cn.areaid = $(this.$els.area).attr('data-id');
  332. this.cn.typeid = $(this.$els.type).val();
  333. var json = Vue.filter('json');
  334. return json.read(this.cn);
  335. }
  336. },
  337. ready : function () {
  338. var that = this;
  339. $.ajax({
  340. url:'{:url('getList')}',// 跳转到 action
  341. data:{page : that.page},
  342. type:'post',
  343. dataType:'json',
  344. success:function(data) {
  345. console.log(data);
  346. if(data.code == 1) {
  347. that.items = data.content.order_list;
  348. that.page = data.content.page;
  349. }
  350. },
  351. error : function() {
  352. alert("异常!");
  353. }
  354. });
  355. },
  356. computed : {
  357. nodata:function(){
  358. return this.items.length == 0 ? true : false;
  359. }
  360. }
  361. })
  362. </script>
  363. <script src="{$Think.config.base_url}/static/admin/js/plugins/datapicker/bootstrap-datepicker.js"></script>
  364. <script>
  365. //日期
  366. $("div[datepicker='datepicker']").datepicker({
  367. keyboardNavigation: !1,
  368. forceParse: !1,
  369. autoclose: !0
  370. });
  371. </script>
  372. <script src="{$Think.config.base_url}/static/admin/js/plugins/suggest/bootstrap-suggest.min.js"></script>
  373. <script>
  374. var testdataBsSuggest = $("#area").bsSuggest({
  375. indexId: 0,
  376. indexKey: 1,
  377. getDataMethod: "url",
  378. effectiveFieldsAlias: {
  379. id: "编号",
  380. keyword: "地区",
  381. },
  382. showHeader: true,
  383. data: {
  384. "value": [{
  385. "id": "0",
  386. "keyword": "lzw",
  387. },
  388. {
  389. "id": "1",
  390. "keyword": "lzwme",
  391. },
  392. {
  393. "id": "2",
  394. "keyword": "meizu",
  395. },
  396. {
  397. "id": "3",
  398. "keyword": "flyme",
  399. }],
  400. "defaults": "http://lzw.me"
  401. },
  402. url: "{:url('getCityListByKeyword')}" + "/keyword/",
  403. processData: function(json) {
  404. console.log(json);
  405. var i, len, data = {
  406. value: []
  407. };
  408. if (json.code!=1) {
  409. return;
  410. }
  411. len = json.content.length;
  412. data.value.push({
  413. "id": 0,
  414. "keyword": "地区不限",
  415. })
  416. for (i = 0; i < len; i++) {
  417. data.value.push({
  418. "id": json.content[i][0],
  419. "keyword": json.content[i][1],
  420. })
  421. }
  422. return data;
  423. }
  424. });
  425. var phonedataBsSuggest = $("#user").bsSuggest({
  426. indexId: 0,
  427. indexKey: 2,
  428. getDataMethod: "url",
  429. effectiveFieldsAlias: {
  430. id: "编号",
  431. truename: "姓名",
  432. keyword: "手机号",
  433. },
  434. showHeader: true,
  435. data: {
  436. "value": [{
  437. "id": "0",
  438. "truename": "",
  439. "keyword": "lzw",
  440. },
  441. {
  442. "id": "1",
  443. "truename": "",
  444. "keyword": "lzwme",
  445. },
  446. {
  447. "id": "2",
  448. "truename": "",
  449. "keyword": "meizu",
  450. },
  451. {
  452. "id": "3",
  453. "truename": "",
  454. "keyword": "flyme",
  455. }],
  456. "defaults": "http://lzw.me"
  457. },
  458. url: "{:url('order/getUser')}" + "/keyword/",
  459. processData: function(json) {
  460. var i, len, data = {
  461. value: []
  462. };
  463. if (json.code!=1) {
  464. return;
  465. }
  466. len = json.content.length;
  467. data.value.push({
  468. "id": 0,
  469. "truename": "姓名不限",
  470. "keyword": "手机不限",
  471. })
  472. for (i = 0; i < len; i++) {
  473. data.value.push({
  474. "id": json.content[i]['u_id'],
  475. "truename": json.content[i]['u_name'],
  476. "keyword": json.content[i]['u_phone'],
  477. })
  478. }
  479. return data;
  480. }
  481. });
  482. </script>
  483. <style>
  484. .chosen-container-single .chosen-single { padding-top: 3px;padding-bottom: 0;padding-left:10px;}
  485. .chosen-container-single .chosen-single div b { background-position: 0px 4px; }
  486. .chosen-container-active.chosen-with-drop .chosen-single div b { background-position-y:4px; }
  487. </style>
  488. <script src="{$Think.config.base_url}/static/admin/js/plugins/datapicker/bootstrap-datepicker.js"></script>
  489. <script src="{$Think.config.base_url}/static/admin/js/plugins/chosen/chosen.jquery.js"></script>
  490. <script>
  491. //日期
  492. $("div[datepicker='datepicker']").datepicker({
  493. keyboardNavigation: !1,
  494. forceParse: !1,
  495. autoclose: !0
  496. });
  497. $("#type").chosen({
  498. no_results_text: "没有找到!",
  499. allow_single_deselect: !0
  500. });
  501. </script>
  502. {include file="public/footer" /}