index.php 9.6 KB

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