subject_update.tpl 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. {include file="public/header-begin" /}
  2. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/webuploader/webuploader.css">
  3. <link rel="stylesheet" href="{$Think.config.resources}/css/demo/webuploader-demo.min.css">
  4. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/datapicker/datepicker3.css">
  5. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/chosen/chosen.css">
  6. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/summernote/summernote.css">
  7. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/summernote/summernote-bs3.css" >
  8. <link rel="stylesheet" href="{$Think.config.resources}/css/plugins/sweetalert/sweetalert.css">
  9. <script src="/static/common/js/vue.js"></script>
  10. {include file="public/header-end" /}
  11. <div class="wrapper wrapper-content">
  12. <form id="form" method="post" class="form-horizontal">
  13. <div class="row">
  14. <div class="col-sm-6">
  15. <div class="ibox float-e-margins no-drop">
  16. <div class="ibox-title">
  17. <h5>产品简介</h5>
  18. <div class="ibox-tools">
  19. <a class="collapse-link">
  20. <i class="fa fa-chevron-up"></i>
  21. </a>
  22. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  23. <i class="fa fa-wrench"></i>
  24. </a>
  25. <ul class="dropdown-menu dropdown-user">
  26. <li><a href="form_basic.html#">选项1</a>
  27. </li>
  28. <li><a href="form_basic.html#">选项2</a>
  29. </li>
  30. </ul>
  31. <a class="close-link">
  32. <i class="fa fa-times"></i>
  33. </a>
  34. </div>
  35. </div>
  36. <div class="ibox-content">
  37. <div class="form-group">
  38. <label class="col-sm-2 control-label">标的标题</label>
  39. <div class="col-sm-10">
  40. {present name="model.package"}
  41. <input name="id" type="hidden" class="form-control" value="{$model.id|default='0'}">
  42. {/present}
  43. <input name="title" type="text" class="form-control" value="{$model.title|default=''}">
  44. </div>
  45. </div>
  46. <div class="hr-line-dashed"></div>
  47. <div class="form-group">
  48. <label class="col-sm-2 control-label">类别</label>
  49. <div class="col-sm-8">
  50. <div class="input-group">
  51. <select id="typeid" name="typeid[]" data-placeholder="选择类别" multiple class="chosen-select" style="width:200px;">
  52. {foreach name="type" item="item"}
  53. <option value="{$item.id}" hassubinfo="true" {in name="item.id" value="$model.typeid|default='1'"}selected{/in}>{$item.title}</option>
  54. {/foreach}
  55. </select>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="hr-line-dashed"></div>
  60. <div class="form-group">
  61. <label class="col-sm-2 control-label">地区</label>
  62. <div class="col-sm-8">
  63. <div class="input-group">
  64. <input name="areaid" type="hidden" value="">
  65. <input name="areatext" data-id="{$model.areaid|default=''}" id="areaid" type="text" class="form-control" value="{$model.areatext|default=''}">
  66. <div class="input-group-btn">
  67. <button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
  68. <span class="caret"></span>
  69. </button>
  70. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  71. </ul>
  72. </div>
  73. <!-- /btn-group -->
  74. </div>
  75. </div>
  76. </div>
  77. <div class="hr-line-dashed"></div>
  78. <div class="form-group">
  79. <label class="col-sm-2 control-label">目的地</label>
  80. <div class="col-sm-10">
  81. <input name="address" id="address" type="text" class="form-control" value="{$model.address|default=''}">
  82. </div>
  83. </div>
  84. <div class="hr-line-dashed"></div>
  85. <div class="form-group">
  86. <label class="col-sm-2 control-label">库存</label>
  87. <div class="col-sm-10">
  88. <input name="ku" id="ku" type="text" class="form-control" value="{$model.ku|default='1000'}">
  89. </div>
  90. </div>
  91. <div class="form-group">
  92. <label class="col-sm-2 control-label">特色</label>
  93. <div class="col-sm-10">
  94. <textarea name="introduce" id="introduce" class="form-control" style="height: 100px;">{$model.introduce|default=''}</textarea>
  95. <span class="help-block m-b-none">不要超过200字</span>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <div class="ibox float-e-margins no-drop">
  101. <div class="ibox-title">
  102. <h5>商品标题图片</h5>
  103. <div class="ibox-tools">
  104. <a class="collapse-link">
  105. <i class="fa fa-chevron-up"></i>
  106. </a>
  107. <a class="dropdown-toggle" data-toggle="dropdown" href="form_file_upload.html#">
  108. <i class="fa fa-wrench"></i>
  109. </a>
  110. <ul class="dropdown-menu dropdown-user">
  111. <li><a href="form_file_upload.html#">选项1</a>
  112. </li>
  113. <li><a href="form_file_upload.html#">选项2</a>
  114. </li>
  115. </ul>
  116. <a class="close-link">
  117. <i class="fa fa-times"></i>
  118. </a>
  119. </div>
  120. </div>
  121. <div class="ibox-content">
  122. <div class="page-container">
  123. <p>支持文件拖拽、QQ截屏工具,或者点击添加图片按钮。</p>
  124. <div id="uploader" class="wu-example">
  125. <div class="queueList">
  126. <div id="dndArea" class="placeholder">
  127. <div id="filePicker"></div>
  128. <p>或将照片拖到这里,单次最多可选3张</p>
  129. </div>
  130. </div>
  131. <div class="statusBar" style="display:none;">
  132. <div class="progress">
  133. <span class="text">0%</span>
  134. <span class="percentage"></span>
  135. </div>
  136. <div class="info"></div>
  137. <div class="btns">
  138. <div id="filePicker2"></div>
  139. <div class="uploadBtn">开始上传</div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div id="thumb">
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="col-sm-6" id="vue">
  150. <div class="ibox float-e-margins" group="package">
  151. <div class="ibox-title">
  152. <h5>套餐</h5>
  153. <div class="ibox-tools">
  154. <a class="collapse-link">
  155. <i class="fa fa-chevron-up"></i>
  156. </a>
  157. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  158. <i class="fa fa-wrench"></i>
  159. </a>
  160. <ul class="dropdown-menu dropdown-user">
  161. <li onclick="clonePackage(this)"><a>:)</a>
  162. </li>
  163. </ul>
  164. <a class="close-link">
  165. <i class="fa fa-times"></i>
  166. </a>
  167. </div>
  168. </div>
  169. <div class="ibox-content" style="text-align: center;">
  170. <table class="table table-hover">
  171. <thead>
  172. <tr>
  173. <th>ID</th>
  174. <th>标题</th>
  175. <th>儿童价</th>
  176. <th>成人价</th>
  177. <th>操作</th>
  178. </tr>
  179. </thead>
  180. <tbody>
  181. <tr v-for="item in items">
  182. <td align="left"><input name="tid[]" type="hidden" v-model="item.id">
  183. <span v-bind:class="{ 'badge badge-danger': item.id==0, 'badge badge-primary': item.id >0}">{{item.id}}</span>
  184. </td>
  185. <td align="left"><input name="ttitle[]" type="hidden" v-model="item.title">{{item.title}}</td>
  186. <td align="left"><input name="price[]" type="hidden" v-model="item.price">¥ {{item.price | priceFilter 2}}</td>
  187. <td align="left"><input name="price2[]" type="hidden" v-model="item.price2">¥ {{item.price2 | priceFilter 2}}</td>
  188. <td align="left">
  189. <a @click="updateShow($index)">[改]</a>
  190. <a @click="updateDel($index, item.id)">[删]</a>
  191. </td>
  192. </tr>
  193. </tbody>
  194. </table>
  195. <a data-toggle="modal" href="#modal-package" class="btn btn-primary btn-lg" @click="updateShow(-1)">新增一个套餐</a>
  196. </div>
  197. </div>
  198. <div class="ibox float-e-margins" group="package">
  199. <div class="ibox-title">
  200. <h5>费用包含</h5>
  201. <div class="ibox-tools">
  202. <a class="collapse-link">
  203. <i class="fa fa-chevron-up"></i>
  204. </a>
  205. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  206. <i class="fa fa-wrench"></i>
  207. </a>
  208. <ul class="dropdown-menu dropdown-user">
  209. <li onclick="clonePackage(this)"><a>:)</a>
  210. </li>
  211. </ul>
  212. <a class="close-link">
  213. <i class="fa fa-times"></i>
  214. </a>
  215. </div>
  216. </div>
  217. <div class="ibox-content" style="text-align: center;">
  218. <textarea name="contain" id="contain" style="width:100%;height:100px;">{$model.content.contain|default=''}</textarea>
  219. </div>
  220. </div>
  221. <div class="ibox float-e-margins" group="package">
  222. <div class="ibox-title">
  223. <h5>费用不包含</h5>
  224. <div class="ibox-tools">
  225. <a class="collapse-link">
  226. <i class="fa fa-chevron-up"></i>
  227. </a>
  228. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  229. <i class="fa fa-wrench"></i>
  230. </a>
  231. <ul class="dropdown-menu dropdown-user">
  232. <li onclick="clonePackage(this)"><a>:)</a>
  233. </li>
  234. </ul>
  235. <a class="close-link">
  236. <i class="fa fa-times"></i>
  237. </a>
  238. </div>
  239. </div>
  240. <div class="ibox-content" style="text-align: center;">
  241. <textarea name="ucontain" id="ucontain" style="width:100%;height:100px;">{$model.content.ucontain|default=''}</textarea>
  242. </div>
  243. </div>
  244. <div class="ibox float-e-margins" group="package">
  245. <div class="ibox-title">
  246. <h5>预定须知</h5>
  247. <div class="ibox-tools">
  248. <a class="collapse-link">
  249. <i class="fa fa-chevron-up"></i>
  250. </a>
  251. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  252. <i class="fa fa-wrench"></i>
  253. </a>
  254. <ul class="dropdown-menu dropdown-user">
  255. <li onclick="clonePackage(this)"><a>:)</a>
  256. </li>
  257. </ul>
  258. <a class="close-link">
  259. <i class="fa fa-times"></i>
  260. </a>
  261. </div>
  262. </div>
  263. <div class="ibox-content" style="text-align: center;">
  264. <textarea name="notice" id="notice" style="width:100%;height:100px;">{$model.content.notice|default=''}</textarea>
  265. </div>
  266. </div>
  267. <div class="ibox float-e-margins" group="package">
  268. <div class="ibox-title">
  269. <h5>退赔规则</h5>
  270. <div class="ibox-tools">
  271. <a class="collapse-link">
  272. <i class="fa fa-chevron-up"></i>
  273. </a>
  274. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  275. <i class="fa fa-wrench"></i>
  276. </a>
  277. <ul class="dropdown-menu dropdown-user">
  278. <li onclick="clonePackage(this)"><a>:)</a>
  279. </li>
  280. </ul>
  281. <a class="close-link">
  282. <i class="fa fa-times"></i>
  283. </a>
  284. </div>
  285. </div>
  286. <div class="ibox-content" style="text-align: center;">
  287. <textarea name="restitution" id="restitution" style="width:100%;height:100px;">{$model.content.restitution|default=''}</textarea>
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. <div class="row">
  293. <div class="col-sm-12">
  294. <div class="ibox float-e-margins no-drop">
  295. <div class="ibox-title">
  296. <h5>产品详细</h5>
  297. <div class="ibox-tools">
  298. <a class="collapse-link">
  299. <i class="fa fa-chevron-up"></i>
  300. </a>
  301. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  302. <i class="fa fa-wrench"></i>
  303. </a>
  304. <ul class="dropdown-menu dropdown-user">
  305. <li><a href="form_basic.html#">选项1</a>
  306. </li>
  307. <li><a href="form_basic.html#">选项2</a>
  308. </li>
  309. </ul>
  310. <a class="close-link">
  311. <i class="fa fa-times"></i>
  312. </a>
  313. </div>
  314. </div>
  315. <div class="ibox-content">
  316. <textarea name="content" id="content" style="width:100%;height:300px;">{$model.content.content|default=''}</textarea>
  317. </div>
  318. </div>
  319. </div>
  320. </div>
  321. <div class="row">
  322. <div class="col-sm-12">
  323. <div class="ibox float-e-margins no-drop">
  324. <div class="ibox-content">
  325. <p style="text-align:center;">
  326. <button type="submit" class="btn btn-primary btn-lg">保存全部</button>
  327. <button type="button" class="btn btn-default btn-lg">返回</button>
  328. </p>
  329. </div>
  330. </div>
  331. </div>
  332. </div>
  333. </form>
  334. </div>
  335. {include file="public/footer-js" /}
  336. <script src="{$Think.config.base_url}/js/jquery-ui-1.10.4.min.js"></script>
  337. <script src="{$Think.config.base_url}/js/content.min.js?v=1.0.0"></script>
  338. <script src="{$Think.config.base_url}/js/plugins/iCheck/icheck.min.js"></script>
  339. <script>
  340. $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
  341. </script>
  342. <script type="text/javascript">
  343. var BASE_URL = '{$Think.config.base_url}/js/plugins/webuploader';
  344. var upyun_api_url = '{:url('/admin/upload/upurl/count/10')}';
  345. var callbackUploadSuccess = function(json, booturl) {
  346. $("<input>",
  347. {
  348. name:'thumb[]',
  349. type:'hidden',
  350. val:booturl + json.url
  351. }
  352. ).appendTo("#thumb");
  353. }
  354. </script>
  355. <script src="{$Think.config.resources}/js/plugins/webuploader/webuploader.min.js"></script>
  356. <script src="{$Think.config.resources}/js/demo/webuploader-demo.js"></script>
  357. <script src="{$Think.config.resources}/js/plugins/chosen/chosen.jquery.js"></script>
  358. <script>
  359. $("#typeid").chosen({
  360. no_results_text: "没有找到!",
  361. allow_single_deselect: !0
  362. });
  363. </script>
  364. <!-- 4、地区部分 -->
  365. <script src="{$Think.config.resources}/js/plugins/suggest/bootstrap-suggest.min.js"></script>
  366. <script>
  367. var testdataBsSuggest = $("#areaid").bsSuggest({
  368. indexId: 0,
  369. indexKey: 1,
  370. getDataMethod: "url",
  371. effectiveFieldsAlias: {
  372. id: "编号",
  373. keyword: "地区",
  374. },
  375. showHeader: true,
  376. data: {
  377. "value": [{
  378. "id": "0",
  379. "keyword": "lzw",
  380. },
  381. {
  382. "id": "1",
  383. "keyword": "lzwme",
  384. },
  385. {
  386. "id": "2",
  387. "keyword": "meizu",
  388. },
  389. {
  390. "id": "3",
  391. "keyword": "flyme",
  392. }],
  393. "defaults": "http://lzw.me"
  394. },
  395. url: "{:url('product/getPos')}" + "/keyword/",
  396. processData: function(json) {
  397. var i, len, data = {
  398. value: []
  399. };
  400. if (json.code!=1) {
  401. return;
  402. }
  403. len = json.content.length;
  404. for (i = 0; i < len; i++) {
  405. data.value.push({
  406. "id": json.content[i][0],
  407. "keyword": json.content[i][1],
  408. })
  409. }
  410. return data;
  411. }
  412. });
  413. </script>
  414. <!-- 3、编辑器部分 -->
  415. <script charset="utf-8" src="{$Think.config.resources}/plugins/kindeditor/kindeditor-all-min.js"></script>
  416. <script charset="utf-8" src="{$Think.config.resources}/plugins/kindeditor/lang/zh-CN.js"></script>
  417. <script>
  418. KindEditor.ready(function(K) {
  419. window.editorContent = K.create('#content');
  420. });
  421. KindEditor.ready(function(K) {
  422. window.editorContain = K.create('#contain', {
  423. items: [
  424. 'source', 'forecolor', 'hilitecolor', 'bold', 'template',
  425. 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat','fullscreen'
  426. ]
  427. });
  428. });
  429. KindEditor.ready(function(K) {
  430. window.editorUcontain = K.create('#ucontain', {
  431. items: [
  432. 'source', 'forecolor', 'hilitecolor', 'bold', 'template',
  433. 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat','fullscreen'
  434. ]
  435. });
  436. });
  437. KindEditor.ready(function(K) {
  438. window.editorNotice = K.create('#notice', {
  439. items: [
  440. 'source', 'forecolor', 'hilitecolor', 'bold', 'template',
  441. 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat','fullscreen'
  442. ]
  443. });
  444. });
  445. KindEditor.ready(function(K) {
  446. window.editorRestitution = K.create('#restitution', {
  447. items: [
  448. 'source', 'forecolor', 'hilitecolor', 'bold', 'template',
  449. 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat','fullscreen'
  450. ]
  451. });
  452. });
  453. </script>
  454. <!-- 4、package部分 -->
  455. <script>
  456. /*var package = $("div[group='package']");
  457. //package.clone(true).find("input[name='tid[]']").remove();
  458. package.find('ul li').click(function() {
  459. package.after(package.clone(true));
  460. });*/
  461. function clonePackage(that) {
  462. //console.log($(that).parents("div[group='package']"));
  463. var parent = $(that).parents("div[group='package']");
  464. var newPackage = parent.clone(true);
  465. newPackage.find("input[name='tid[]']").remove();
  466. $(parent).after(newPackage);
  467. }
  468. </script>
  469. <!-- 5、拖动部分 -->
  470. <script>
  471. $(document).ready(function(){WinMove()});
  472. </script>
  473. <!-- 6、表单部分 -->
  474. <script src="{$Think.config.resources}/js/plugins/sweetalert/sweetalert.min.js"></script>
  475. <script src="{$Think.config.resources}/static/common/js/jquery.form.js"></script>
  476. <script type="text/javascript">
  477. $(function() {
  478. var optionsForm = {
  479. beforeSubmit: function(arr, $form, options) {
  480. for (x of arr) {
  481. if(x.name == 'areaid') {
  482. x.value = $("#areaid").attr('data-id');
  483. }
  484. if(x.name == 'content') {
  485. x.value = editorContent.html();
  486. }
  487. if(x.name == 'contain') {
  488. x.value = editorContain.html();
  489. }
  490. if(x.name == 'ucontain') {
  491. x.value = editorUcontain.html();
  492. }
  493. if(x.name == 'notice') {
  494. x.value = editorNotice.html();
  495. }
  496. if(x.name == 'restitution') {
  497. x.value = editorRestitution.html();
  498. }
  499. //console.log(arr);
  500. }
  501. //$("button[type='submit']").attr("disabled","disabled");
  502. },
  503. success: function (data) {
  504. if(data.code==1) {
  505. swal({
  506. title: data.msg,
  507. type: "success"
  508. },function () {
  509. window.location.href = data.forward;
  510. })
  511. }
  512. else {
  513. swal({
  514. title: data.msg,
  515. type: "warning"
  516. })
  517. $("button[type='submit']").removeAttr("disabled");
  518. }
  519. }
  520. };
  521. $("#form").ajaxForm(optionsForm);
  522. });
  523. </script>
  524. <!-- 7.套餐部分 -->
  525. <!--
  526. <script src="{$Think.config.resources}/js/plugins/datapicker/bootstrap-datepicker.js"></script>
  527. <script>
  528. //日期
  529. $("div[datepicker='datepicker']").datepicker({
  530. keyboardNavigation: !1,
  531. forceParse: !1,
  532. autoclose: !0
  533. });
  534. </script>
  535. -->
  536. <div class="modal inmodal" id="modal-package" tabindex="-1" role="dialog" aria-hidden="true">
  537. <div class="modal-dialog">
  538. <div class="modal-content animated bounceInRight">
  539. <div class="modal-header">
  540. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
  541. </button>
  542. <h4 class="modal-title">更新套餐</h4>
  543. </div>
  544. <div class="modal-body form-horizontal">
  545. <div class="form-group">
  546. <label class="col-sm-3 control-label">套餐标题</label>
  547. <div class="col-sm-8">
  548. <input name="tid[]" class="form-control" type="hidden" v-model="item.id">
  549. <input name="ttitle[]" class="form-control" type="text" value="" v-model="item.title">
  550. </div>
  551. </div>
  552. <div class="form-group">
  553. <label class="col-sm-3 control-label">成人价/儿童价</label>
  554. <div class="col-sm-4">
  555. <div class="input-group"><span class="input-group-addon">¥</span>
  556. <input name="price[]" type="text" class="form-control" value="" v-model="item.price"> <span class="input-group-addon">.00</span>
  557. </div>
  558. </div>
  559. <div class="col-sm-4">
  560. <div class="input-group"><span class="input-group-addon">¥</span>
  561. <input name="price2[]" type="text" class="form-control" value="" v-model="item.price2"> <span class="input-group-addon">.00</span>
  562. </div>
  563. </div>
  564. </div>
  565. <!--
  566. <div class="form-group">
  567. <label class="col-sm-3 control-label">报价有效</label>
  568. <div class="col-sm-8">
  569. <div class="input-daterange input-group" datepicker="datepicker">
  570. <input type="text" class="input-sm form-control" name="starttime[]" value="{$item.starttime}" />
  571. <span class="input-group-addon">到</span>
  572. <input type="text" class="input-sm form-control" name="endtime[]" value="{$item.endtime}" />
  573. </div>
  574. </div>
  575. </div>
  576. -->
  577. </div>
  578. <div class="modal-footer">
  579. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  580. <button type="button" class="btn btn-primary" @click="updateAct()">保存</button>
  581. </div>
  582. </div>
  583. </div>
  584. </div>
  585. <script>
  586. Vue.filter('priceFilter', function (value, num) {
  587. return parseFloat(value).toFixed(num);
  588. })
  589. new Vue({
  590. el: 'body',
  591. data: {
  592. items: [
  593. {present name="model.package"}
  594. {volist name="model.package" id="item"}
  595. {
  596. id:{$item.id},
  597. title:"{$item.title}",
  598. price:{$item.price},
  599. price2:{$item.price2},
  600. },
  601. {/volist}
  602. {/present}
  603. ],
  604. item : {
  605. id : 0,
  606. title : "",
  607. price : "",
  608. price2 : "",
  609. },
  610. package: -1,//package是新增还是更新,-1是新增,大于-1的话是更新
  611. load : false,
  612. },
  613. methods: {
  614. updateShow: function(index) {
  615. var priceFilter = Vue.filter('priceFilter');
  616. if(index == -1) {
  617. this.item.id = 0;
  618. this.item.title = "";
  619. this.item.price = "";
  620. this.item.price2 = "";
  621. this.package = index;
  622. return;
  623. }
  624. var item = this.items[index];
  625. this.item.title = item.title;
  626. this.item.price = priceFilter(item.price, 0);
  627. this.item.price2 = priceFilter(item.price2, 0);
  628. this.package = index;
  629. $('#modal-package').modal('toggle');
  630. },
  631. updateAct: function() {
  632. var priceFilter = Vue.filter('priceFilter');
  633. if(this.package == -1) {
  634. this.items.push({
  635. id:0,
  636. title:this.item.title,
  637. price:priceFilter(this.item.price, 2),
  638. price2:priceFilter(this.item.price2, 2),
  639. });
  640. $('#modal-package').modal('toggle');
  641. return;
  642. }
  643. var item = this.items[this.package];
  644. item.title = this.item.title;
  645. item.price = priceFilter(this.item.price, 2),
  646. item.price2 = priceFilter(this.item.price2, 2),
  647. $('#modal-package').modal('toggle');
  648. },
  649. updateDel: function(index, id) {
  650. swal({
  651. title: "您确定要删除这条信息吗",
  652. text: "删除后将无法恢复,请谨慎操作!",
  653. type: "warning",
  654. showCancelButton: true,
  655. confirmButtonColor: "#DD6B55",
  656. confirmButtonText: "删除",
  657. closeOnConfirm: false
  658. }, function () {
  659. $.getJSON('{:url('packageDel')}' + '/?id=' + id, function(data) {
  660. if(data.code == 1) {
  661. that.items.splice(index, 1);
  662. swal("删除成功!", "您已经永久删除了这条信息。", "success");
  663. return;
  664. }
  665. swal("删除失败!", "不知道啥原因", "error");
  666. });
  667. });
  668. var that = this;
  669. }
  670. },
  671. ready : function () {
  672. /*var that = this;
  673. $.getJSON('{:url('index')}',function(data) {
  674. if(data.code == 1) {
  675. that.items = data.content;
  676. }
  677. });*/
  678. },
  679. computed : {
  680. /*nodata:function(){
  681. return this.items.length == 0 ? true : false;
  682. }*/
  683. }
  684. })
  685. </script>
  686. {include file="public/footer" /}