user-list.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. $diyPath = dirname(__DIR__) . '/components';
  4. ComponentHelper::loadComponentView('achievement-edit', $diyPath);
  5. ?>
  6. <style>
  7. </style>
  8. <div id="app" v-cloak>
  9. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  10. <div slot="header">
  11. <span>团长列表</span>
  12. </div>
  13. <div class="table-body">
  14. <div style="margin-bottom: 20px;">
  15. <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="editClick">添加团长</el-button>
  16. </div>
  17. <div class="input-item">
  18. <el-input @keyup.enter.native="loadData" size="small" placeholder="请输入用户id" v-model="search.user_id"
  19. clearable @clear="toSearch">
  20. </el-input>
  21. </div>
  22. <div class="input-item">
  23. <el-input @keyup.enter.native="loadData" size="small" placeholder="请输入用户昵称/手机号搜索" v-model="search.keyword" clearable @clear="toSearch">
  24. </el-input>
  25. </div>
  26. <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="toSearch">搜索</el-button>
  27. <el-tabs v-model="activeName" @tab-click="handleClick">
  28. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;"
  29. @selection-change="handleSelectionChange">
  30. <el-table-column prop="user_id" label="用户ID" align="center"></el-table-column>
  31. <el-table-column label="基本信息" >
  32. <template slot-scope="scope">
  33. <div class="user_img" flex="cross:center">
  34. <el-image class="default-avatar" :src="scope.row.avatar_url">
  35. <div slot="error" class="image-slot">
  36. <com-image src="resources/img/mall/default_avatar_url.png"></com-image>
  37. </div>
  38. </el-image>
  39. <div class="uer-nickname over1" v-if="scope.row.nickname">{{scope.row.nickname}}</div>
  40. <div class="uer-nickname over1" v-else >ID:{{scope.row.user_id}}</div>
  41. </div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="手机号" prop="mobile" align="center" >
  45. <template slot-scope="scope">
  46. <div>{{scope.row.mobile}}</div>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="累计佣金" prop="total_price" align="center">
  50. <template slot-scope="scope">
  51. <template>{{scope.row.total_commission}}</template>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="推荐人" prop="parent_name" align="center">
  55. <template slot-scope="scope">
  56. <template v-if="scope.row.parent_id">
  57. <template v-if="scope.row.parent_name">{{scope.row.parent_name}}</template>
  58. <template v-else>ID:{{scope.row.parent_id}}</template>
  59. </template>
  60. <template v-else>平台</template>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="时间" align="center">
  64. <template slot-scope="scope">
  65. 成为团长时间:<br>{{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="操作" align="center">
  69. <template slot-scope="scope">
  70. <el-button circle size="mini" type="text" @click="achievementDelete(scope.row, scope.$index)">
  71. <el-tooltip class="item" effect="dark" content="删除2" placement="top">
  72. <img src="resources/img/mall/del.png" alt="">
  73. </el-tooltip>
  74. </el-button>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. </el-tabs>
  79. <div flex="box:last cross:center">
  80. <div></div>
  81. <div>
  82. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
  83. style="display: inline-block;float: right;" background @current-change="pageChange"
  84. layout="prev, pager, next" :total="pagination.totalCount">
  85. </el-pagination>
  86. </div>
  87. </div>
  88. </div>
  89. </el-card>
  90. <achievement-edit v-model="edit.show" @savesuccess="stockEditFun"></achievement-edit>
  91. </div>
  92. <script>
  93. const app = new Vue({
  94. el: '#app',
  95. data: {
  96. avatar: '',
  97. nickname: '',
  98. search: {
  99. user_id: null,
  100. keyword: '',
  101. status: -1,
  102. page: 1,
  103. level: ''
  104. },
  105. loading: false,
  106. activeName: '-1',
  107. list: [],
  108. pagination: null,
  109. dialogLoading: false,
  110. select: {
  111. nickname: '',
  112. status: 'first',
  113. },
  114. dialogContent: false,
  115. edit: {
  116. show: false,
  117. },
  118. choose_list: [],
  119. },
  120. mounted() {
  121. this.loadData();
  122. },
  123. methods: {
  124. achievementDelete(row, index) {
  125. let self = this;
  126. self.$confirm('删除该团长, 是否继续?', '提示', {
  127. confirmButtonText: '确定',
  128. cancelButtonText: '取消',
  129. type: 'warning'
  130. }).then(() => {
  131. self.listLoading = true;
  132. request({
  133. params: {
  134. r: 'achievement/default/delete',
  135. },
  136. method: 'post',
  137. data: {
  138. id: row.id,
  139. }
  140. }).then(e => {
  141. self.listLoading = false;
  142. if (e.data.code === 0) {
  143. self.$message.success(e.data.msg);
  144. self.list.splice(index, 1);
  145. } else {
  146. self.$message.error(e.data.msg);
  147. }
  148. }).catch(e => {
  149. console.log(e);
  150. });
  151. }).catch(() => {
  152. self.$message.info('已取消删除')
  153. });
  154. },
  155. confirmSubmit() {
  156. console.log(this.activeName)
  157. this.search.status = this.activeName
  158. },
  159. loadData() {
  160. this.loading = true;
  161. let params = {
  162. r: 'achievement/default/user-list'
  163. };
  164. params = Object.assign(params, this.search);
  165. request({
  166. params: params,
  167. method: 'get',
  168. }).then(e => {
  169. this.loading = false;
  170. if (e.data.code == 0) {
  171. this.list = e.data.data.list;
  172. this.pagination = e.data.data.pagination;
  173. } else {
  174. this.$message.error(e.data.msg);
  175. }
  176. }).catch(e => {
  177. this.loading = false;
  178. });
  179. },
  180. pageChange(page) {
  181. this.search.page = page;
  182. this.loadData();
  183. },
  184. handleClick(tab, event) {
  185. this.search.page = 1;
  186. this.search.status = this.activeName;
  187. this.loadData()
  188. },
  189. toSearch() {
  190. this.search.page = 1;
  191. this.loadData();
  192. },
  193. editClick() {
  194. this.edit.show = true;
  195. },
  196. editLevel(row) {
  197. this.level.show = true;
  198. this.level.agent = row;
  199. },
  200. handleSelectionChange(val) {
  201. let self = this;
  202. self.choose_list = [];
  203. val.forEach(function (item) {
  204. self.choose_list.push(item.id);
  205. })
  206. },
  207. levelSuccess() {
  208. this.loadData();
  209. },
  210. stockEditFun(){
  211. this.loadData();
  212. }
  213. }
  214. });
  215. </script>
  216. <style>
  217. .el-tabs__header {
  218. font-size: 16px;
  219. }
  220. .table-body {
  221. padding: 20px;
  222. background-color: #fff;
  223. }
  224. .table-body .el-button {
  225. padding: 0 !important;
  226. border: 0;
  227. margin: 0 5px;
  228. }
  229. .input-item {
  230. width: 250px;
  231. margin: 0 0 20px;
  232. display: inline-block;
  233. }
  234. /*.input-item .el-input__inner {*/
  235. /* border-right: 0;*/
  236. /*}*/
  237. .input-item .el-input__inner:hover {
  238. border: 1px solid #dcdfe6;
  239. /*border-right: 0;*/
  240. outline: 0;
  241. }
  242. .input-item .el-input__inner:focus {
  243. border: 1px solid #dcdfe6;
  244. /*border-right: 0;*/
  245. outline: 0;
  246. }
  247. .input-item .el-input-group__append {
  248. background-color: #fff;
  249. border-left: 0;
  250. width: 10%;
  251. padding: 0;
  252. }
  253. .input-item .el-input-group__append .el-button {
  254. padding: 0;
  255. }
  256. .input-item .el-input-group__append .el-button {
  257. margin: 0;
  258. }
  259. .batch {
  260. margin: 0 0 20px;
  261. display: inline-block;
  262. }
  263. .batch .el-button {
  264. padding: 9px 15px !important;
  265. }
  266. .el-table th>.cell{
  267. color: #333;
  268. font-weight: bold;
  269. font-size: 14px;
  270. }
  271. .el-table__footer-wrapper, .el-table__header-wrapper{
  272. border-bottom: 1.4px solid #D6D6D6;
  273. }
  274. .el-table th>.cell {
  275. color: #333;
  276. font-weight: bold;
  277. font-size: 14px;
  278. }
  279. .table1 .el-table__footer-wrapper,
  280. .table1 .el-table__header-wrapper {
  281. border-bottom: 1.4px solid #D6D6D6;
  282. }
  283. .user_img{
  284. position: relative;
  285. margin-right: 8px;
  286. /* height: 50px;
  287. width: 50px; */
  288. }
  289. .default-avatar{
  290. width: 50px;
  291. height: 50px;
  292. border-radius: 50%;
  293. margin-right: 8px;
  294. }
  295. .uer-nickname {
  296. flex: 1;
  297. }
  298. </style>