user-log.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <?php
  2. /**
  3. * @link:http://www.goodmall.com/
  4. * @copyright: Copyright (c) 2020
  5. * Created by PhpStorm
  6. * Author: ganxiaohao
  7. * Date: 2020-05-08
  8. * Time: 17:50
  9. */
  10. use common\helpers\ComponentHelper;
  11. use common\helpers\AddonHelper;
  12. ComponentHelper::loadComponentView('achievement-details', AddonHelper::getAddonRootPath('Pk') . 'backend/views/components');
  13. ?>
  14. <div id="app" v-cloak>
  15. <el-card class="box-card" shadow="never" style="border:0;min-width: 1200px;"
  16. body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  17. <div slot="header">
  18. <el-breadcrumb separator="/">
  19. <el-breadcrumb-item>
  20. <span style="color: #409EFF;cursor: pointer"
  21. @click="$navigate({r:'pk/personal/index'})"><!--mall/stock/level -->
  22. 个人PK
  23. </span>
  24. </el-breadcrumb-item>
  25. <el-breadcrumb-item>人员列表</el-breadcrumb-item>
  26. </el-breadcrumb>
  27. </div>
  28. <div class="table-body">
  29. <div class="head" style="display: flex;margin-bottom: 30px;flex-wrap: wrap;">
  30. <div style="display: flex;width: 220px;margin-right: 20px;align-items: center;margin-bottom: 15px;">
  31. <div style="flex-shrink: 0;align-items: center;">人员名称:</div>
  32. <el-input clearable size="small" type="text" v-model="search.nickname" @keyup.enter.native="toSearch" placeholder="请输入人员名称"></el-input>
  33. </div>
  34. <div style="display: flex;margin-right: 20px;align-items: center;margin-bottom: 15px;">
  35. <div style="flex-shrink: 0;align-items: center;">加入时间:</div>
  36. <el-date-picker
  37. size="small"
  38. v-model="time"
  39. @change="datetimeChange"
  40. :picker-options="pickerOptions"
  41. type="daterange"
  42. range-separator="至"
  43. start-placeholder="开始日期"
  44. end-placeholder="结束日期"
  45. value-format="yyyy-MM-dd"
  46. align="center">
  47. </el-date-picker>
  48. </div>
  49. <el-button size="mini" type="primary" icon="el-icon-search" style="height: 32px;" @click='toSearch'>搜索</el-button>
  50. <el-button size="mini" type="danger" style="height: 32px;" @click='resetFun'>重置</el-button>
  51. </div>
  52. <el-table
  53. class="table1"
  54. v-loading="loading"
  55. :data="list"
  56. size="small"
  57. stripe
  58. style="width: 100%">
  59. <el-table-column
  60. type="index"
  61. label="序号"
  62. align="center"
  63. min-width="60">
  64. </el-table-column>
  65. <el-table-column
  66. prop="activity.name"
  67. label="活动名称"
  68. align="center"
  69. min-width="100">
  70. <template slot-scope="scope">
  71. <!-- {{formatTime(scope.row.created_at)}} -->
  72. {{activity.name}}
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. label="人员名称"
  77. min-width="150">
  78. <template slot-scope="scope">
  79. <div style="display: flex;align-items: center;">
  80. <el-image fit="cover" :src="scope.row.user.avatar_url?scope.row.user.avatar_url:'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
  81. <div>
  82. <div>{{scope.row.user.nickname}}</div>
  83. <div>ID {{scope.row.user.id}}</div>
  84. </div>
  85. </div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. label="金额"
  90. align="center"
  91. min-width="100" v-if="type == 2">
  92. <template slot-scope="scope">
  93. <!-- {{formatTime(scope.row.created_at)}} -->
  94. {{scope.row.money}}
  95. </template>
  96. </el-table-column>
  97. <el-table-column
  98. label="人数"
  99. align="center"
  100. min-width="100" v-if="type == 1">
  101. <template slot-scope="scope">
  102. 1
  103. </template>
  104. </el-table-column>
  105. <el-table-column
  106. label="PK类型"
  107. align="center"
  108. min-width="80">
  109. <template slot-scope="scope">
  110. <div v-if="type == 1">拉新</div>
  111. <div v-else>业绩</div>
  112. </template>
  113. </el-table-column>
  114. <el-table-column
  115. prop="created_at"
  116. label="加入时间"
  117. align="center"
  118. min-width="100">
  119. <template slot-scope="scope">
  120. <!-- {{formatTime(scope.row.created_at)}} -->
  121. {{scope.row.created_at | dateTimeFormat('Y-m-d H:i') }}
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. <div flex="box:last cross:center" style="margin-top: 15px;"><!-- v-if="list.length > 0" -->
  126. <div></div>
  127. <div>
  128. <el-pagination
  129. style="display: inline-block;float: right;"
  130. background
  131. @current-change="pageChange"
  132. layout="prev, pager, next"
  133. :page-count="pageCount"
  134. >
  135. </el-pagination>
  136. </div>
  137. </div>
  138. </div>
  139. </el-card>
  140. </div>
  141. <script>
  142. const app = new Vue({
  143. el: '#app',
  144. data() {
  145. return {
  146. edit:{
  147. show:false,
  148. },
  149. id:0,
  150. time:'',
  151. pageCount:0,
  152. loading:false,
  153. srcList:[],
  154. activity:[],
  155. PKlist:[//活动类型;1拉新;2业绩
  156. {name:'全部',value:''},
  157. {name:'拉新PK',value:1},
  158. {name:'业绩PK',value:2},
  159. ],
  160. search: {
  161. page: 1,
  162. nickname:'',
  163. begin_time:'',
  164. end_time:'',
  165. },
  166. statusList:[//状态;0未开始;1进行中;2已结束;3已取消;
  167. {name:'全部',value:''},
  168. {name:'未开始',value:0},
  169. {name:'进行中',value:1},
  170. {name:'已结束',value:2},
  171. {name:'已取消',value:3},
  172. ],
  173. pickerOptions: {
  174. shortcuts: [{
  175. text: '最近一周',
  176. onClick(picker) {
  177. const end = new Date();
  178. const start = new Date();
  179. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  180. picker.$emit('pick', [start, end]);
  181. }
  182. }, {
  183. text: '最近一个月',
  184. onClick(picker) {
  185. const end = new Date();
  186. const start = new Date();
  187. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  188. picker.$emit('pick', [start, end]);
  189. }
  190. }, {
  191. text: '最近三个月',
  192. onClick(picker) {
  193. const end = new Date();
  194. const start = new Date();
  195. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  196. picker.$emit('pick', [start, end]);
  197. }
  198. }]
  199. },
  200. activity_type:'',
  201. type:1,
  202. user_id:'',
  203. list:[
  204. ]
  205. };
  206. },
  207. mounted() {
  208. if(getQuery('id')){
  209. this.id = getQuery('id');
  210. }
  211. if(getQuery('type')){
  212. this.type = getQuery('type');
  213. }
  214. if(getQuery('user_id')){
  215. this.user_id = getQuery('user_id');
  216. }
  217. this.getList();
  218. },
  219. watch:{
  220. },
  221. methods: {
  222. resetFun(){
  223. this.search = {
  224. page: 1,
  225. nickname:'',
  226. begin_time:'',
  227. end_time:'',
  228. }
  229. this.time = '';
  230. this.getList();
  231. },
  232. pageChange(page){
  233. this.search.page = page;
  234. this.getList();
  235. },
  236. previewImg(img){
  237. this.srcList.push(img);
  238. },
  239. datetimeChange(){
  240. if(this.time){
  241. this.search.begin_time = this.time[0];
  242. this.search.end_time = this.time[1];
  243. }else{
  244. this.search.begin_time = '';
  245. this.search.end_time = '';
  246. }
  247. this.getList();
  248. },
  249. toSearch() {
  250. this.search.page = 1;
  251. this.getList();
  252. },
  253. formatTime(timeStamp) {
  254. var date = new Date();
  255. date.setTime(timeStamp * 1000);
  256. var y = date.getFullYear();
  257. var m = date.getMonth() + 1;
  258. m = m < 10 ? ('0' + m) : m;
  259. var d = date.getDate();
  260. d = d < 10 ? ('0' + d) : d;
  261. var h = date.getHours();
  262. h = h < 10 ? ('0' + h) : h;
  263. var minute = date.getMinutes();
  264. var second = date.getSeconds();
  265. minute = minute < 10 ? ('0' + minute) : minute;
  266. second = second < 10 ? ('0' + second) : second;
  267. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  268. },
  269. getList(){
  270. let params = {
  271. r: 'pk/personal/user-log',//个人活动队员列表
  272. activity_id:this.id,
  273. activity_type:this.type,
  274. user_id:this.user_id,
  275. limit:10
  276. };
  277. params = Object.assign(params, this.search);
  278. //console.log('请求前的params='+JSON.stringify(params))
  279. this.loading = true;
  280. request({
  281. params: params,
  282. method: 'get',
  283. }).then(e => {
  284. //console.log('个人活动队员列表='+JSON.stringify(e))
  285. this.loading = false;
  286. if (e.data.code == 0) {
  287. this.list = e.data.data.list;
  288. this.activity = e.data.data.activity;
  289. this.activity_type = e.data.data.activity_type;
  290. this.pageCount = e.data.data.page_count;
  291. } else {
  292. this.$message.error(e.data.msg);
  293. }
  294. }).catch(e => {
  295. this.loading = false;
  296. });
  297. }
  298. }
  299. });
  300. </script>
  301. <style>
  302. .form-body {
  303. padding: 20px;
  304. background-color: #fff;
  305. margin-bottom: 20px;
  306. padding-right: 20%;
  307. min-width: 900px;
  308. }
  309. .form-body .el-form-item {
  310. padding-right: 25%;
  311. min-width: 850px;
  312. }
  313. .form-button {
  314. margin: 0;
  315. }
  316. .form-button .el-form-item__content {
  317. margin-left: 0 !important;
  318. }
  319. .button-item {
  320. padding: 9px 25px;
  321. }
  322. .check-group {
  323. font-size: 14px !important;
  324. }
  325. .check-group .el-col {
  326. display: flex;
  327. }
  328. .check-group .el-input {
  329. margin: 0 5px;
  330. }
  331. .check-group .el-col .el-checkbox {
  332. display: flex;
  333. align-items: center;
  334. }
  335. .check-group .el-col .el-input {
  336. width: 100px;
  337. }
  338. .check-group .el-col .el-input .el-input__inner {
  339. height: 30px;
  340. width: 100px;
  341. }
  342. .el-checkbox-group .el-col {
  343. margin-bottom: 10px;
  344. }
  345. .add-image-btn {
  346. width: 100px;
  347. height: 100px;
  348. color: #419EFB;
  349. border: 1px solid #e2e2e2;
  350. cursor: pointer;
  351. }
  352. .table-body {
  353. padding: 20px;
  354. background-color: #fff;
  355. }
  356. .el-table thead{
  357. font-size: 14px;
  358. color: #333;
  359. }
  360. .table1 .el-table__footer-wrapper,.table1 .el-table__header-wrapper{
  361. border-bottom: 1.4px solid #D6D6D6;
  362. }
  363. .el-date-editor .el-range-separator{/* 设置选择日期框的中间的 ‘至’ 的宽度 */
  364. width: 8%;
  365. }
  366. </style>