information.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('卡种信息列表')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="col-sm-12 search-collapse">
  10. <form id="formId">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. <label>名称:</label>
  15. <input type="text" name="name"/>
  16. </li>
  17. <li>
  18. <label>类型:</label>
  19. <select name="type" th:with="type=${@dict.getType('card_type')}">
  20. <option value="">所有</option>
  21. <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
  22. th:value="${dict.dictValue}"></option>
  23. </select>
  24. </li>
  25. <li>
  26. <label>卡种状态:</label>
  27. <select name="cardState" th:with="type=${@dict.getType('goods_state')}">
  28. <option value="">所有</option>
  29. <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
  30. th:value="${dict.dictValue}"></option>
  31. </select>
  32. </li>
  33. <li>
  34. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  35. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  36. </li>
  37. </ul>
  38. </div>
  39. </form>
  40. </div>
  41. <div class="btn-group-sm" id="toolbar" role="group">
  42. <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:information:add">
  43. <i class="fa fa-plus"></i> 添加
  44. </a>
  45. <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:information:edit">
  46. <i class="fa fa-edit"></i> 修改
  47. </a>
  48. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:information:remove">
  49. <i class="fa fa-remove"></i> 删除
  50. </a>
  51. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:information:export">
  52. <i class="fa fa-download"></i> 导出
  53. </a>
  54. </div>
  55. <div class="col-sm-12 select-table table-striped">
  56. <table id="bootstrap-table"></table>
  57. </div>
  58. </div>
  59. </div>
  60. <th:block th:include="include :: footer" />
  61. <script th:inline="javascript">
  62. var editFlag = [[${@permission.hasPermi('system:information:edit')}]];
  63. var removeFlag = [[${@permission.hasPermi('system:information:remove')}]];
  64. var prefix = ctx + "information";
  65. var cardType = [[${@dict.getType('card_type')}]];
  66. var sysJobStatus = [[${@dict.getType('goods_state')}]];
  67. $(function() {
  68. var options = {
  69. url: prefix + "/list",
  70. createUrl: prefix + "/add",
  71. updateUrl: prefix + "/edit/{id}",
  72. releaseUrl: prefix + "/edit",
  73. removeUrl: prefix + "/remove",
  74. exportUrl: prefix + "/export",
  75. modalName: "卡种信息",
  76. columns: [{
  77. checkbox: true
  78. },
  79. {
  80. field: 'id',
  81. title: '主键',
  82. visible: false
  83. },
  84. {
  85. field: 'name',
  86. title: '名称'
  87. },
  88. {
  89. field: 'type',
  90. title: '类型',
  91. formatter: function (value, row, index) {
  92. return $.table.selectDictLabel(cardType, value);
  93. }
  94. },
  95. {
  96. field: 'totalNumber',
  97. title: '可用次数'
  98. },
  99. {
  100. field: 'originalPrice',
  101. title: '原价格'
  102. },
  103. {
  104. field: 'memberPrice',
  105. title: '会员价格'
  106. },
  107. {
  108. field: 'point',
  109. title: '单次积分'
  110. },
  111. {
  112. visible: true,
  113. field: 'cardState',
  114. title: '卡种状态',
  115. formatter: function (value, row, index) {
  116. return statusTools(row);
  117. }
  118. },
  119. {
  120. title: '操作',
  121. align: 'center',
  122. formatter: function(value, row, index) {
  123. var actions = [];
  124. if (row.cardState=='2'){
  125. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  126. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
  127. }
  128. return actions.join('');
  129. }
  130. }]
  131. };
  132. $.table.init(options);
  133. });
  134. /* 商品状态显示 */
  135. function statusTools(row) {
  136. if (row.cardState == 2) {
  137. return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
  138. } else {
  139. return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
  140. }
  141. }
  142. /* 用户管理-停用 */
  143. function disable(id) {
  144. $.modal.confirm("确认要下架商品吗?", function() {
  145. $.operate.post(prefix + "/edit", { "id": id, "cardState": 2 });
  146. })
  147. }
  148. /* 用户管理启用 */
  149. function enable(id) {
  150. $.modal.confirm("确认要上架商品吗?", function() {
  151. $.operate.post(prefix + "/edit", { "id": id, "cardState": 1 });
  152. })
  153. }
  154. </script>
  155. </body>
  156. </html>