city_index.tpl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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. <div class="pull-right mail-search" style="max-width: inherit">
  12. <table class="zq_search">
  13. <tr>
  14. <td>
  15. <div class="input-group" style="width:300px">
  16. <input id="area" data-id="{$cityid}" placeholder="在这里输入城市关键词,比如曼谷" type="text" class="form-control input-sm" value="" style="font-size:12px;" v-el:area>
  17. <div class="input-group-btn">
  18. <button type="button" class="btn btn-white dropdown-toggle btn-sm" data-toggle="dropdown">
  19. <span class="caret"></span>
  20. </button>
  21. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  22. </ul>
  23. </div>
  24. </div>
  25. </td>
  26. <td>
  27. <button @click="search" type="button" class="btn btn-sm btn-primary">选择</button>
  28. </td>
  29. </tr>
  30. </table>
  31. </div>
  32. <h2>
  33. {$ptype_text}价格设置 - {{city.name_cn}} {{city.name_en}}
  34. </h2>
  35. <div class="mail-tools tooltip-demo m-t-md">
  36. <div class="btn-group pull-right">
  37. <table class="zq_search">
  38. <tr>
  39. <td>
  40. <div class="btn-group">
  41. <button class="btn btn-sm btn-primary" type="button" @click="pricenatureTroggle()">新建价格规则</button>
  42. </div>
  43. </td>
  44. </tr>
  45. </table>
  46. </div>
  47. 有效报价时间:{$begintime} 到 {$endtime}(包含当天)
  48. </div>
  49. </div>
  50. <div class="mail-box" style="position: relative; padding: 20px">
  51. <table class="table table-hover table-mail">
  52. <thead>
  53. <tr>
  54. <th style="text-align: center">#</th>
  55. <th>ID</th>
  56. <th>规则</th>
  57. <th>标题</th>
  58. <th>优先级</th>
  59. <th>价格开始时间(包含当天)</th>
  60. <th>价格结束时间(包含当天)</th>
  61. <th>更新时间</th>
  62. <th>操作</th>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <tr class="read" v-for="(index,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>
  71. <span>{{item.id}}</span>
  72. </td>
  73. <td>
  74. <span>{{item.nature_text}}</span>
  75. </td>
  76. <td>
  77. <span>{{item.title}}</span>
  78. <span class="label label-danger pull-right" v-if="item.cartype.length > 0">{{item.cartype}}</span>
  79. </td>
  80. <td>
  81. <span>{{item.level}}</span>
  82. </td>
  83. <td>
  84. <span v-if="item.nature == 0 || item.nature == 1 || item.nature == 2">--</span>
  85. <span v-else>
  86. {{item.begintime}}
  87. </span>
  88. </td>
  89. <td>
  90. <span v-if="item.nature == 0 || item.nature == 1 || item.nature == 2">--</span>
  91. <span v-else>
  92. {{item.endtime}}
  93. </span>
  94. </td>
  95. <td>
  96. <span>{{item.edittime}}</span>
  97. </td>
  98. <td class="">
  99. <a href="{:url('edit')}/?cityid={{city.cityid}}&pricenatureid={{item.id}}&ptype={{item.ptype}}">
  100. 基价
  101. </a>
  102. <a @click="priceurgentTroggle(index)">
  103. 时价
  104. </a>
  105. <a v-if="item.nature > 0" @click="delCityPricenature(item.id)">
  106. 删除
  107. </a>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <table class="table table-mail" v-show="nodata">
  113. <tbody>
  114. <td height="250" align="center" valign="middle">
  115. <h1>:( 没有数据,修改搜索条件试试!</h1>
  116. </td>
  117. </tbody>
  118. </table>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <div class="modal inmodal" id="modal-urgent" tabindex="-1" role="dialog" aria-hidden="true">
  124. <div class="modal-dialog" style="width:900px">
  125. <div class="modal-content animated bounceInRight">
  126. <div class="modal-header">
  127. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
  128. </button>
  129. <h4 class="modal-title">更新急单加价({{currentPricenature.title}})</h4>
  130. </div>
  131. <div class="modal-body form-horizontal">
  132. <div class="form-group">
  133. <label class="col-sm-2 control-label">新的急单加价规则</label>
  134. <div class="col-sm-2">
  135. <select v-model="newUrgent.type" class="form-control select select-sm m-b" name="account" style="height: 30px; padding: 0; padding-left: 5px">
  136. <option value="0" selected>车型</option>
  137. <option value="1">全部</option>
  138. </select>
  139. </div>
  140. <div class="col-sm-6">
  141. <input style="display: inline; width: 50px" type="text" v-model="newUrgent.hour" class="form-control input-sm">
  142. <span style="display: inline"> 小时内,加价 </span>
  143. <input style="display: inline; width: 50px" type="text" v-model="newUrgent.percent" class="form-control input-sm">
  144. <span style="display: inline"> % 或者 ¥</span>
  145. <input style="display: inline; width: 60px" type="text" v-model="newUrgent.price" class="form-control input-sm">
  146. <span style="display: inline"> 元 </span>
  147. </div>
  148. <div class="col-sm-2">
  149. <button type="button" class="btn btn-sm btn-white" style="display: inline" @click="setLocalUrgent()">新增</button>
  150. </div>
  151. </div>
  152. <div class="hr-line-dashed"></div>
  153. <div class="form-group" v-for="(index,item) in urgent" track-by="$index">
  154. <div class="col-sm-12" v-if="item.price > 0">
  155. &nbsp;距用车【{{item.hour}}】小时以内下单,<span v-if="item.type == 0">【车型套餐】</span><span v-else>【附加行程】</span>价格再加 ¥ {{item.price}} 元
  156. - <span @click="delLocalUrgent(index)">删除</span>
  157. </div>
  158. <div class="col-sm-12" v-else>
  159. &nbsp;距用车【{{item.hour}}】小时以内下单,<span v-if="item.type == 0">【车型套餐】</span><span v-else>【附加行程】</span>价格加价的 {{item.percent}}%
  160. - <span @click="delLocalUrgent(index)">删除</span>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="modal-footer">
  165. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  166. <button type="button" class="btn btn-primary" @click="setUrgent()">保存</button>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. <div class="modal inmodal" id="modal-pricenature" tabindex="-1" role="dialog" aria-hidden="true">
  172. <div class="modal-dialog">
  173. <div class="modal-content animated bounceInRight">
  174. <div class="modal-header">
  175. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
  176. </button>
  177. <h4 class="modal-title">新增价格规则</h4>
  178. </div>
  179. <div class="modal-body form-horizontal">
  180. <div class="form-group">
  181. <label class="col-sm-2 control-label">规则标识</label>
  182. <div class="col-sm-10 ">
  183. <input type="text" class="input-sm form-control" v-model="newPricenature.title" placeholder="比如,端午节;如果不知道填什么,请留空,系统会自动生成" />
  184. </div>
  185. </div>
  186. <div class="form-group">
  187. <label class="col-sm-2 control-label">规则类型</label>
  188. <div class="col-sm-10 ">
  189. <select v-model="newPricenature.nature" class="form-control select select-sm m-b" style="height: 30px; padding: 0; padding-left: 10px">
  190. {foreach name="natureLang" item="item" key="k"}
  191. <option value="{$k}">{$item}</option>
  192. {/foreach}
  193. </select>
  194. </div>
  195. </div>
  196. <div class="form-group">
  197. <label class="col-sm-2 control-label">有效时间</label>
  198. <div class="col-sm-10 ">
  199. <div class="input-daterange input-group" id="datepicker">
  200. <input type="text" class="input-sm form-control" v-model="newPricenature.begintime" />
  201. <span class="input-group-addon">到</span>
  202. <input type="text" class="input-sm form-control" v-model="newPricenature.endtime" />
  203. </div>
  204. </div>
  205. </div>
  206. <div class="form-group">
  207. <label class="col-sm-2 control-label">优先级</label>
  208. <div class="col-sm-3 ">
  209. <input type="number" class="input-sm form-control" v-model="newPricenature.level" placeholder="此处填写0-9数字" />
  210. </div>
  211. <label class="col-sm-7 control-label" style="text-align: left">填写0-9数字,仅针对“自定义”规则类型有效</label>
  212. </div>
  213. </div>
  214. <div class="modal-footer">
  215. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  216. <button type="button" class="btn btn-primary" @click="setCityPricenature()">保存</button>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. {include file="public/footer-js" /}
  222. <script>
  223. Vue.filter('reverse', function (value) {
  224. return value.split('').reverse().join('')
  225. })
  226. Vue.filter('statusFilter', function (value) {
  227. switch(value)
  228. {
  229. case 0:
  230. return 'label-info';
  231. case 1:
  232. return 'label-danger';
  233. case 2:
  234. return 'label-danger';
  235. case 3:
  236. return 'label-danger';
  237. case 4:
  238. return 'label-danger';
  239. case 5:
  240. return 'label-danger';
  241. default:
  242. return 'label-danger';
  243. }
  244. });
  245. new Vue({
  246. el: '#wrapper',
  247. data: {
  248. items:[],
  249. city:{},
  250. ptype:{$ptype},
  251. newPricenature:{
  252. title:'',
  253. nature:5,
  254. begintime:'2016-09-09',
  255. endtime:'2016-09-09',
  256. level:0
  257. },
  258. currentPricenature:{},
  259. newUrgent:{
  260. type:1,
  261. hour:6,
  262. price:0.00,
  263. percent:12
  264. },
  265. urgent:[]
  266. },
  267. computed : {
  268. /* _urgent: function () {
  269. this.urgent.push(htis.newUrgent);
  270. }*/
  271. },
  272. methods: {
  273. search:function() {
  274. //有些非标准组件无法进行双向绑定;this.$els.area是需要在节点设置的
  275. var that = this;
  276. $.ajax( {
  277. url:'{:url('getCityByCityid')}',
  278. data:{
  279. cityid: $(that.$els.area).attr('data-id')
  280. },
  281. type:'post',
  282. dataType:'json',
  283. success:function(data) {
  284. if(data.code == 1) {
  285. that.city = data.content;
  286. $.ajax({
  287. url:'{:url('getCityPricenatureList')}',
  288. data:{
  289. cityid: $(that.$els.area).attr('data-id'),
  290. ptype:that.ptype
  291. },
  292. type:'post',
  293. dataType:'json',
  294. success:function(data) {
  295. if(data.code == 1) {
  296. that.items = data.content;
  297. }
  298. },
  299. error : function() {
  300. //alert("异常!");
  301. }
  302. });
  303. }
  304. },
  305. error : function() {
  306. //alert("异常!");
  307. }
  308. });
  309. },
  310. pricenatureTroggle: function() {
  311. $('#modal-pricenature').modal('toggle');
  312. },
  313. priceurgentTroggle: function(index) {
  314. $('#modal-urgent').modal('toggle');
  315. this.currentPricenature = this.items[index];
  316. var urgentJson = this.currentPricenature.urgent;
  317. if(urgentJson.length > 0) {
  318. this.urgent = JSON.parse(urgentJson);
  319. console.log(this.urgent);
  320. }
  321. else {
  322. this.urgent = [];
  323. }
  324. },
  325. setCityPricenature: function() {
  326. var that = this;
  327. this.newPricenature.cityid = this.city.cityid;
  328. this.newPricenature.ptype = this.ptype;
  329. $.ajax({
  330. url:'{:url('setCityPricenature')}',
  331. data:this.newPricenature,
  332. type:'post',
  333. dataType:'json',
  334. success:function(data) {
  335. $('#modal-pricenature').modal('toggle');
  336. if(data.code == 1) {
  337. swal(data.msg);
  338. that.search();
  339. }
  340. else {
  341. swal('出错了 - ' + data.msg);
  342. }
  343. },
  344. error : function() {
  345. swal('出错了 - ' + data.msg);
  346. }
  347. });
  348. },
  349. delCityPricenature: function(id) {
  350. var that = this;
  351. $.ajax({
  352. url:'{:url('delCityPricenature')}',
  353. data:{
  354. pricenatureid: id
  355. },
  356. type:'post',
  357. dataType:'json',
  358. success:function(data) {
  359. if(data.code == 1) {
  360. swal(data.msg);
  361. that.search();
  362. }
  363. },
  364. error : function() {
  365. //alert("异常!");
  366. }
  367. });
  368. },
  369. setLocalUrgent: function() {
  370. console.log(this.urgent);
  371. this.urgent.push({
  372. type:this.newUrgent.type,
  373. hour:this.newUrgent.hour,
  374. price:this.newUrgent.price,
  375. percent:this.newUrgent.percent,
  376. });
  377. },
  378. delLocalUrgent: function(index) {
  379. console.log(index);
  380. this.urgent.splice(index,1);
  381. },
  382. setUrgent: function() {
  383. var that = this;
  384. $.ajax({
  385. url:'{:url('setUrgent')}',
  386. data:{
  387. pricenatureid:that.currentPricenature.id,
  388. urgent:that.urgent
  389. },
  390. type:'post',
  391. dataType:'json',
  392. success:function(data) {
  393. $('#modal-urgent').modal('toggle');
  394. if(data.code == 1) {
  395. swal(data.msg);
  396. that.search();
  397. }
  398. else {
  399. swal('出错了 - ' + data.msg);
  400. }
  401. },
  402. error : function() {
  403. swal('出错了 - ' + '未知错误');
  404. }
  405. });
  406. }
  407. },
  408. ready : function () {
  409. this.search();
  410. },
  411. })
  412. </script>
  413. <!-- 日期开始 -->
  414. <script src="{$Think.config.base_url}/static/admin/js/plugins/datapicker/bootstrap-datepicker.js"></script>
  415. <script>
  416. //日期
  417. $("#datepicker").datepicker({
  418. keyboardNavigation: !1,
  419. forceParse: !1,
  420. autoclose: !0,
  421. orientation: "top left"
  422. });
  423. </script>
  424. <script src="{$Think.config.base_url}/static/admin/js/plugins/suggest/bootstrap-suggest.min.js"></script>
  425. <script>
  426. var testdataBsSuggest = $("#area").bsSuggest({
  427. indexId: 0,
  428. indexKey: 1,
  429. getDataMethod: "url",
  430. effectiveFieldsAlias: {
  431. cityid: "编号",
  432. name_la: "地区",
  433. },
  434. showHeader: true,
  435. data: {
  436. "value": [{
  437. "cityid": "0",
  438. "name_la": "lzw",
  439. },
  440. {
  441. "cityid": "1",
  442. "name_la": "lzwme",
  443. }],
  444. "defaults": "http://lzw.me"
  445. },
  446. url: "{:url('getCityListByKeyword')}" + "/?keyword=",
  447. processData: function(json) {
  448. var i, len, data = {
  449. value: []
  450. };
  451. if (json.code!=1) {
  452. return;
  453. }
  454. len = json.content.length;
  455. for (i = 0; i < len; i++) {
  456. data.value.push({
  457. "cityid": json.content[i]['cityid'],
  458. "name_la": json.content[i]['name_la'],
  459. })
  460. }
  461. return data;
  462. }
  463. });
  464. </script>
  465. {include file="public/footer" /}