list.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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="scope.activity.name"
  67. label="活动名称"
  68. align="center"
  69. min-width="100">
  70. <template slot-scope="scope">
  71. <!-- {{formatTime(scope.row.created_at)}} -->
  72. {{scope.row.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. prop="performance"
  90. label="个人目标"
  91. align="center"
  92. min-width="80">
  93. <template slot-scope="scope">
  94. {{scope.row.target}}<span v-if="type == 1">人</span>
  95. <span v-else>元</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column
  99. prop="num"
  100. label="个人排名"
  101. align="center"
  102. min-width="80">
  103. <template slot-scope="scope" v-if="type == 1">
  104. {{ scope.row.new_user_num <= 0 ? '暂无排名' : 10*(search.page-1) + scope.$index+1 }}
  105. </template>
  106. <template slot-scope="scope" v-else>
  107. {{ scope.row.order_money_num <= 0 ? '暂无排名' : 10*(search.page-1) + scope.$index+1 }}
  108. </template>
  109. </el-table-column>
  110. <el-table-column
  111. prop="num"
  112. label="个人成绩"
  113. align="center"
  114. min-width="80">
  115. <template slot-scope="scope">
  116. {{type == 1?scope.row.new_user_num+'人':scope.row.order_money_num+'元'}}
  117. </template>
  118. </el-table-column>
  119. <el-table-column
  120. label="PK类型"
  121. align="center"
  122. min-width="80">
  123. <template slot-scope="scope">
  124. <div v-if="type == 1">拉新</div>
  125. <div v-else>业绩</div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column
  129. prop="created_at"
  130. label="加入时间"
  131. align="center"
  132. min-width="100">
  133. <template slot-scope="scope">
  134. <!-- {{formatTime(scope.row.created_at)}} -->
  135. {{scope.row.created_at | dateTimeFormat('Y-m-d H:i') }}
  136. </template>
  137. </el-table-column>
  138. <el-table-column
  139. label="操作"
  140. align="center"
  141. min-width="150">
  142. <template slot-scope="scope">
  143. <el-button size="mini" type="primary" @click="showDetail(scope.row)">成绩明细<i class="el-icon-caret-right el-icon--right"></i></el-button>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. <div flex="box:last cross:center" style="margin-top: 15px;"><!-- v-if="list.length > 0" -->
  148. <div></div>
  149. <div>
  150. <el-pagination
  151. style="display: inline-block;float: right;"
  152. background
  153. @current-change="pageChange"
  154. layout="prev, pager, next"
  155. :page-count="pageCount"
  156. >
  157. </el-pagination>
  158. </div>
  159. </div>
  160. </div>
  161. </el-card>
  162. </div>
  163. <script>
  164. const app = new Vue({
  165. el: '#app',
  166. data() {
  167. return {
  168. edit:{
  169. show:false,
  170. },
  171. id:0,
  172. time:'',
  173. pageCount:0,
  174. loading:false,
  175. srcList:[],
  176. PKlist:[//活动类型;1拉新;2业绩
  177. {name:'全部',value:''},
  178. {name:'拉新PK',value:1},
  179. {name:'业绩PK',value:2},
  180. ],
  181. search: {
  182. page: 1,
  183. nickname:'',
  184. begin_time:'',
  185. end_time:'',
  186. },
  187. statusList:[//状态;0未开始;1进行中;2已结束;3已取消;
  188. {name:'全部',value:''},
  189. {name:'未开始',value:0},
  190. {name:'进行中',value:1},
  191. {name:'已结束',value:2},
  192. {name:'已取消',value:3},
  193. ],
  194. pickerOptions: {
  195. shortcuts: [{
  196. text: '最近一周',
  197. onClick(picker) {
  198. const end = new Date();
  199. const start = new Date();
  200. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  201. picker.$emit('pick', [start, end]);
  202. }
  203. }, {
  204. text: '最近一个月',
  205. onClick(picker) {
  206. const end = new Date();
  207. const start = new Date();
  208. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  209. picker.$emit('pick', [start, end]);
  210. }
  211. }, {
  212. text: '最近三个月',
  213. onClick(picker) {
  214. const end = new Date();
  215. const start = new Date();
  216. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  217. picker.$emit('pick', [start, end]);
  218. }
  219. }]
  220. },
  221. activity_type:'',
  222. type:1,
  223. list:[
  224. ]
  225. };
  226. },
  227. mounted() {
  228. if(getQuery('id')){
  229. this.id = getQuery('id');
  230. }
  231. if(getQuery('type')){
  232. this.type = getQuery('type');
  233. }
  234. this.getList();
  235. },
  236. watch:{
  237. },
  238. methods: {
  239. resetFun(){
  240. this.search = {
  241. page: 1,
  242. nickname:'',
  243. begin_time:'',
  244. end_time:'',
  245. }
  246. this.time = '';
  247. this.getList();
  248. },
  249. pageChange(page){
  250. this.search.page = page;
  251. this.getList();
  252. },
  253. previewImg(img){
  254. this.srcList.push(img);
  255. },
  256. datetimeChange(){
  257. if(this.time){
  258. this.search.begin_time = this.time[0];
  259. this.search.end_time = this.time[1];
  260. }else{
  261. this.search.begin_time = '';
  262. this.search.end_time = '';
  263. }
  264. this.getList();
  265. },
  266. toSearch() {
  267. this.search.page = 1;
  268. this.getList();
  269. },
  270. formatTime(timeStamp) {
  271. var date = new Date();
  272. date.setTime(timeStamp * 1000);
  273. var y = date.getFullYear();
  274. var m = date.getMonth() + 1;
  275. m = m < 10 ? ('0' + m) : m;
  276. var d = date.getDate();
  277. d = d < 10 ? ('0' + d) : d;
  278. var h = date.getHours();
  279. h = h < 10 ? ('0' + h) : h;
  280. var minute = date.getMinutes();
  281. var second = date.getSeconds();
  282. minute = minute < 10 ? ('0' + minute) : minute;
  283. second = second < 10 ? ('0' + second) : second;
  284. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  285. },
  286. getList(){
  287. let params = {
  288. r: 'pk/personal/list',//个人活动队员列表
  289. activity_id:this.id,
  290. activity_type:this.type,
  291. limit:10
  292. };
  293. params = Object.assign(params, this.search);
  294. //console.log('请求前的params='+JSON.stringify(params))
  295. this.loading = true;
  296. request({
  297. params: params,
  298. method: 'get',
  299. }).then(e => {
  300. //console.log('个人活动队员列表='+JSON.stringify(e))
  301. this.loading = false;
  302. if (e.data.code == 0) {
  303. this.list = e.data.data.list;
  304. this.activity_type = e.data.data.activity_type;
  305. this.pageCount = e.data.data.page_count;
  306. } else {
  307. this.$message.error(e.data.msg);
  308. }
  309. }).catch(e => {
  310. this.loading = false;
  311. });
  312. },
  313. showDetail(row){
  314. navigateTo({
  315. r: 'pk/personal/user-log',
  316. id: this.id,
  317. type: this.type,
  318. user_id:row.user.id,
  319. });
  320. }
  321. }
  322. });
  323. </script>
  324. <style>
  325. .form-body {
  326. padding: 20px;
  327. background-color: #fff;
  328. margin-bottom: 20px;
  329. padding-right: 20%;
  330. min-width: 900px;
  331. }
  332. .form-body .el-form-item {
  333. padding-right: 25%;
  334. min-width: 850px;
  335. }
  336. .form-button {
  337. margin: 0;
  338. }
  339. .form-button .el-form-item__content {
  340. margin-left: 0 !important;
  341. }
  342. .button-item {
  343. padding: 9px 25px;
  344. }
  345. .check-group {
  346. font-size: 14px !important;
  347. }
  348. .check-group .el-col {
  349. display: flex;
  350. }
  351. .check-group .el-input {
  352. margin: 0 5px;
  353. }
  354. .check-group .el-col .el-checkbox {
  355. display: flex;
  356. align-items: center;
  357. }
  358. .check-group .el-col .el-input {
  359. width: 100px;
  360. }
  361. .check-group .el-col .el-input .el-input__inner {
  362. height: 30px;
  363. width: 100px;
  364. }
  365. .el-checkbox-group .el-col {
  366. margin-bottom: 10px;
  367. }
  368. .add-image-btn {
  369. width: 100px;
  370. height: 100px;
  371. color: #419EFB;
  372. border: 1px solid #e2e2e2;
  373. cursor: pointer;
  374. }
  375. .table-body {
  376. padding: 20px;
  377. background-color: #fff;
  378. }
  379. .el-table thead{
  380. font-size: 14px;
  381. color: #333;
  382. }
  383. .table1 .el-table__footer-wrapper,.table1 .el-table__header-wrapper{
  384. border-bottom: 1.4px solid #D6D6D6;
  385. }
  386. .el-date-editor .el-range-separator{/* 设置选择日期框的中间的 ‘至’ 的宽度 */
  387. width: 8%;
  388. }
  389. </style>