index.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-export-dialog');
  4. ?>
  5. <style>
  6. .link_url {
  7. text-align: left;
  8. font-size: 14px;
  9. }
  10. .showqr .el-dialog__body {
  11. text-align: center;
  12. padding-bottom: 10px;
  13. }
  14. .el-dialog {
  15. min-width: 400px;
  16. }
  17. </style>
  18. <div id="app" v-cloak>
  19. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  20. <div slot="header">
  21. <span>素材分类列表</span>
  22. <div style="float: right;margin-top: -5px">
  23. <el-button type="primary"
  24. @click="$navigate({r: 'business-card/material-cate/edit'})"
  25. size="small">新增分类
  26. </el-button>
  27. </div>
  28. </div>
  29. <div class="search-box">
  30. <!-- 搜索 -->
  31. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  32. <el-form-item label="分类名称">
  33. <el-input placeholder="请输入分类名称" v-model="searchForm.name"></el-input>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button type="primary" @click="search">搜索</el-button>
  37. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  38. </el-form-item>
  39. </el-form>
  40. </div>
  41. <div class="table-body">
  42. <el-tabs>
  43. <el-table :data="list" border v-loading="loading" size="small" style="margin-bottom: 15px;">
  44. <el-table-column prop="id" label="ID" align="center" width="100"></el-table-column>
  45. <el-table-column prop="name" label="名称" align="left" min-width="125"></el-table-column>
  46. <el-table-column label="关联素材" prop="child_num" align="center" width="125"></el-table-column>
  47. <el-table-column prop="order_sort" label="排序" align="center" width="100"></el-table-column>
  48. <el-table-column
  49. label="是否启用"
  50. align="center"
  51. width="100">
  52. <template slot-scope="scope">
  53. <el-switch
  54. @change="((val)=>{switchFun(val, scope.row.id, 'status')})"
  55. v-model="scope.row.status"
  56. :active-value="1"
  57. :inactive-value="0"
  58. >
  59. </el-switch>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="操作" align="center" width="200">
  63. <template slot-scope="scope">
  64. <el-button type="text" @click="handle('edit',scope.row)">编辑</el-button>
  65. <el-button type="text" @click="handle('destroy',scope.row)">删除</el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <div style="text-align: right;margin: 20px 0;">
  70. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  71. </div>
  72. </el-tabs>
  73. </div>
  74. </el-card>
  75. </div>
  76. <script>
  77. const app = new Vue({
  78. el: '#app',
  79. data: {
  80. loading: false,
  81. page: 1,
  82. pageCount: 0,
  83. list: [],
  84. searchForm:{
  85. name: null,
  86. },
  87. level_list: [], // 等级列表
  88. status_option: [
  89. {index: 0, name: '待结算'},
  90. {index: 1, name: '已结算'},
  91. ],
  92. export_list: {},
  93. export_url: '/business-bonus/reward/index',
  94. },
  95. mounted() {
  96. this.getList();
  97. },
  98. computed: {
  99. show_clear_search_btn: function() {
  100. return this.searchForm.name != null;
  101. },
  102. },
  103. methods: {
  104. pagination(currentPage) {
  105. let self = this;
  106. self.page = currentPage;
  107. self.getList(this.searchForm);
  108. },
  109. search() {// 清空查询条件
  110. this.page = 1;
  111. this.getList(this.searchForm);
  112. },
  113. resetSearch() {// 清空查询条件
  114. this.searchForm = {
  115. name: null
  116. };
  117. this.page = 1;
  118. this.getList();
  119. },
  120. switchFun(val, id, field) {
  121. if (field == 'status') {
  122. let param = {id: id, status: val};
  123. this.send('business-card/material-cate/handle',param)
  124. }
  125. },
  126. handle(type, data = null) {
  127. let id = data ? parseInt(data.id) : '';
  128. switch (type) {
  129. case 'edit':
  130. let params = {
  131. r: 'business-card/material-cate/edit'
  132. };
  133. if (id) params = Object.assign(params, {
  134. id: id
  135. });
  136. navigateTo(params);
  137. break;
  138. case 'detail':
  139. let param = {
  140. r: 'business-card/material-cate/detail'
  141. };
  142. if (id) param = Object.assign(param, {
  143. id: id
  144. });
  145. navigateTo(param);
  146. break;
  147. case 'destroy':
  148. let param2 = {id: data.id,status: -1};
  149. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {
  150. this.send('business-card/material-cate/handle',param2)
  151. })
  152. break;
  153. }
  154. },
  155. send(url, params, callback = null) {
  156. let self = this;
  157. request({
  158. params: {
  159. r: url,
  160. },
  161. method: 'post',
  162. data: params
  163. }).then(e => {
  164. if (e.data.code == 0) {
  165. self.$message.success(e.data.msg);
  166. self.getList();
  167. } else {
  168. self.$message.error(e.data.msg);
  169. }
  170. }).catch(e => {
  171. console.log(e);
  172. });
  173. if(callback) return e.data;
  174. },
  175. getList(search = {}) {
  176. let self = this;
  177. self.loading = true;
  178. let basic_params = {
  179. page: self.page,
  180. };
  181. let params = Object.assign(basic_params, search);
  182. request({
  183. params: {
  184. r: 'business-card/material-cate/index'
  185. },
  186. method: 'post',
  187. data: params
  188. }).then(e => {
  189. self.loading = false;
  190. if (e.data.code == 0) {
  191. self.list = e.data.data.list;
  192. console.log(self.list)
  193. self.pageCount = e.data.data.page_count;
  194. } else {
  195. self.$message.error(e.data.msg);
  196. }
  197. }).catch(e => {
  198. self.loading = false;
  199. });
  200. },
  201. getBusinessBonusLevel()
  202. {
  203. let self = this;
  204. request({
  205. params: {
  206. r: 'business-bonus/default/business-bonus-level'
  207. },
  208. method: 'post',
  209. data: {}
  210. }).then(e => {
  211. if (e.data.code == 0) {
  212. self.level_list = e.data.data.level_list;
  213. } else {
  214. self.$message.error(e.data.msg);
  215. }
  216. }).catch(e => {
  217. });
  218. }
  219. }
  220. });
  221. </script>
  222. <style>
  223. .el-tabs__header {
  224. font-size: 16px;
  225. }
  226. .table-body {
  227. padding: 20px;
  228. background-color: #fff;
  229. }
  230. .table-body .el-button {
  231. padding: 0 !important;
  232. border: 0;
  233. margin: 0 5px;
  234. }
  235. .input-item {
  236. width: 250px;
  237. margin: 0 0 20px;
  238. display: inline-block;
  239. }
  240. .input-item .el-input__inner {
  241. border-right: 0;
  242. }
  243. .input-item .el-input__inner:hover {
  244. border: 1px solid #dcdfe6;
  245. border-right: 0;
  246. outline: 0;
  247. }
  248. .input-item .el-input__inner:focus {
  249. border: 1px solid #dcdfe6;
  250. border-right: 0;
  251. outline: 0;
  252. }
  253. .input-item .el-input-group__append {
  254. background-color: #fff;
  255. border-left: 0;
  256. width: 10%;
  257. padding: 0;
  258. }
  259. .input-item .el-input-group__append .el-button {
  260. padding: 0;
  261. }
  262. .input-item .el-input-group__append .el-button {
  263. margin: 0;
  264. }
  265. .batch {
  266. margin: 0 0 20px;
  267. display: inline-block;
  268. }
  269. .batch .el-button {
  270. padding: 9px 15px !important;
  271. }
  272. .el-table th>.cell{
  273. color: #333;
  274. font-weight: bold;
  275. font-size: 14px;
  276. }
  277. .el-table__footer-wrapper, .el-table__header-wrapper{
  278. }
  279. .search-box {
  280. padding: 10px 0 0 10px;
  281. background-color: #fff;
  282. margin-bottom: 10px;
  283. }
  284. </style>