agency.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. @extends('layouts.base')
  2. @section('title', '代理商管理')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
  5. <div id='re_content'>
  6. <div class="con">
  7. <div class="setting">
  8. <div class="block">
  9. <el-form label-width="10%">
  10. <div class="title" style="justify-content: space-between;">
  11. <div style="display:flex;align-items:center;">
  12. <span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>代理商管理</b>
  13. </div>
  14. <a href="{!! yzWebFullUrl('plugin.agency.admin.agency.add-page') !!} ">
  15. <el-button size="mini" type="primary">添加代理商</el-button>
  16. </a>
  17. </div>
  18. <el-input v-model="search_form.member_info" style="width:15%;margin-right:16px;"
  19. placeholder="可搜索昵称/姓名/手机号"></el-input>
  20. <el-select v-model="search_form.level_id" placeholder="代理商等级"
  21. style="margin-right:16px;width:12%;" clearable>
  22. <el-option
  23. v-for="item in levels"
  24. :key="item.id"
  25. :label="item.title"
  26. :value="item.id">
  27. </el-option>
  28. </el-select>
  29. <el-select v-model="search_form.search_time" clearable placeholder="时间不限">
  30. <el-option label="时间不限" value="0"></el-option>
  31. <el-option label="搜索时间" value="1"></el-option>
  32. </el-select>
  33. <el-date-picker
  34. v-model="times"
  35. type="datetimerange"
  36. value-format="yyyy-MM-dd HH:mm:ss"
  37. range-separator="至"
  38. start-placeholder="开始日期"
  39. end-placeholder="结束日期"
  40. style="margin-left:5px;"
  41. align="right">
  42. </el-date-picker>
  43. <a>
  44. <el-button type="primary" icon="el-icon-search" @click="search()">搜索</el-button>
  45. </a>
  46. </el-form>
  47. </div>
  48. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  49. <div class="block">
  50. <div class="title">
  51. <div style="display:flex;align-items:center;"><span
  52. style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>代理商列表</b>
  53. </div>
  54. </div>
  55. </div>
  56. <template style="margin-top:-10px;">
  57. <el-table
  58. :data="tableData"
  59. style="padding:0 10px"
  60. >
  61. <el-table-column
  62. prop="created_at"
  63. align="center"
  64. label="成为代理商时间"
  65. >
  66. <template slot-scope="scope">
  67. [[scope.row.created_at]]
  68. </template>
  69. </el-table-column>
  70. <el-table-column
  71. prop="uid"
  72. align="center"
  73. label="会员ID"
  74. >
  75. </el-table-column>
  76. <el-table-column
  77. align="center"
  78. label="代理商"
  79. >
  80. <template slot-scope="scope">
  81. <div>
  82. <div class="vue-ellipsis">
  83. <el-image :src="scope.row.avatar"
  84. style='width:30px;height:30px;padding:1px;border:1px solid #ccc'></el-image>
  85. </div>
  86. <div class="vue-ellipsis">[[scope.row.nickname]]</div>
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column
  91. align="center"
  92. label="手机号"
  93. >
  94. <template slot-scope="scope">
  95. <div>
  96. <div class="vue-ellipsis">[[scope.row.mobile]]</div>
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. prop="level_name"
  102. align="center"
  103. label="代理商等级"
  104. >
  105. </el-table-column>
  106. <el-table-column
  107. align="center"
  108. label="操作"
  109. >
  110. <template slot-scope="scope">
  111. <el-button size="mini" style="margin-right: 10px;" @click="goEdit(scope.row)">编辑
  112. </el-button>
  113. <el-button size="mini" style="margin-right: 10px;" @click="del(scope, tableData)">删除
  114. </el-button>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <el-row style="background-color:#fff;">
  119. <el-col :span="24" align="center" migra style="padding:15px 5% 15px 0" v-loading="loading">
  120. <el-pagination background @current-change="currentChange"
  121. :current-page="current_page"
  122. layout="prev, pager, next"
  123. :page-size="Number(page_size)" :current-page="current_page"
  124. :total="page_total"></el-pagination>
  125. </el-col>
  126. </el-row>
  127. </template>
  128. </div>
  129. </div>
  130. </div>
  131. <script>
  132. var vm = new Vue({
  133. el: "#re_content",
  134. delimiters: ['[[', ']]'],
  135. data() {
  136. return {
  137. loading: false,
  138. page_total: 0,
  139. page_size: 0,
  140. current_page: 0,
  141. search_loading: false,
  142. all_loading: false,
  143. info: {},
  144. search_form: {
  145. name: '',
  146. rank_type: '',
  147. search_time: '0',
  148. start_time: "",
  149. end_time: "",
  150. },
  151. levels: [],
  152. real_search_form: {},
  153. tableData: [],
  154. times: [],
  155. }
  156. },
  157. mounted() {
  158. this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.level.get-all') !!}')
  159. .then(function (response) {
  160. this.levels = response.data.data;
  161. }
  162. );
  163. this.search();
  164. },
  165. methods: {
  166. del(scope, rows) {
  167. this.$confirm('是否删除?', '提示', {
  168. confirmButtonText: '确定',
  169. cancelButtonText: '取消',
  170. type: 'warning'
  171. }).then(() => {
  172. rows.splice(scope.$index, 1);
  173. let json = {
  174. id: scope.row.id
  175. }
  176. this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.agency.delete') !!}', json).then(function (response) {
  177. if (response.data.result) {
  178. this.$message({message: "删除成功", type: "success"});
  179. this.loading = false;
  180. } else {
  181. this.$message({message: response.data.msg, type: 'error'});
  182. }
  183. }, function (response) {
  184. console.log(response);
  185. this.loading = false;
  186. }
  187. );
  188. }).catch(() => {
  189. this.$message({
  190. type: 'info',
  191. message: '已取消操作'
  192. });
  193. });
  194. },
  195. goEdit(item) {
  196. let link = `{!! yzWebFullUrl('plugin.agency.admin.agency.add-page') !!}` + `&id=` + item.id;
  197. window.location.href = link;
  198. },
  199. search() {
  200. console.log(this.times);
  201. if (this.times && this.times.length > 0) {
  202. this.search_form.start_time = this.times[0];
  203. this.search_form.end_time = this.times[1];
  204. }
  205. this.search_loading = true;
  206. let json = {
  207. search: this.search_form,
  208. }
  209. this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.agency.get-list') !!}', json
  210. ).then(function (response) {
  211. if (response.data.result) {
  212. let datas = response.data.data;
  213. this.tableData = datas.data
  214. this.page_total = datas.total;
  215. this.page_size = datas.per_page;
  216. this.current_page = datas.current_page;
  217. this.loading = false;
  218. this.real_search_form = Object.assign({}, this.search_form);
  219. } else {
  220. this.$message({message: response.data.msg, type: 'error'});
  221. }
  222. this.search_loading = false;
  223. }, function (response) {
  224. this.search_loading = false;
  225. this.$message({message: response.data.msg, type: 'error'});
  226. }
  227. );
  228. },
  229. currentChange(val) {
  230. this.loading = true;
  231. this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.agency.get-list') !!}', {
  232. page: val,
  233. search: this.real_search_form
  234. }).then(function (response) {
  235. if (response.data.result) {
  236. let datas = response.data.data;
  237. this.tableData = datas.data
  238. this.page_total = datas.total;
  239. this.page_size = datas.per_page;
  240. this.current_page = datas.current_page;
  241. this.loading = false;
  242. } else {
  243. this.$message({message: response.data.msg, type: 'error'});
  244. }
  245. }, function (response) {
  246. console.log(response);
  247. this.loading = false;
  248. }
  249. );
  250. },
  251. },
  252. });
  253. </script>
  254. @endsection