index.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-export-dialog');
  4. ?>
  5. <style>
  6. .link_url {
  7. text-align: left;
  8. font-size: 14px;
  9. }
  10. .showqr .el-dialog__body {
  11. text-align: center;
  12. padding-bottom: 10px;
  13. }
  14. .el-dialog {
  15. min-width: 400px;
  16. }
  17. </style>
  18. <div id="app" v-cloak>
  19. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  20. <div slot="header">
  21. <span>客户管理</span>
  22. </div>
  23. <div class="search-box">
  24. <!-- 搜索 -->
  25. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  26. <el-form-item label="客户ID">
  27. <el-input placeholder="请输入客户ID" v-model="searchForm.user_id"></el-input>
  28. </el-form-item>
  29. <el-form-item label="客户">
  30. <el-input placeholder="请输入昵称/手机号" v-model="searchForm.nickname"></el-input>
  31. </el-form-item>
  32. <el-form-item label="最近观看时间">
  33. <el-date-picker
  34. size="small"
  35. v-model="searchForm.recent_time"
  36. type="datetimerange"
  37. value-format="yyyy-MM-dd HH:mm:ss"
  38. range-separator="至"
  39. start-placeholder="开始日期"
  40. end-placeholder="结束日期">
  41. </el-date-picker>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-button type="primary" @click="search">搜索</el-button>
  45. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  46. </el-form-item>
  47. </el-form>
  48. </div>
  49. <div class="table-body">
  50. <el-tabs>
  51. <el-table :data="list" border v-loading="loading" size="small" style="margin-bottom: 15px;">
  52. <el-table-column prop="user_id" label="客户ID" align="center"></el-table-column>
  53. <el-table-column align="left" label="客户" :show-overflow-tooltip="true" min-width="100">
  54. <template slot-scope="scope" v-if="scope.row.user">
  55. <div flex="cross:center">
  56. <div style="margin-right: 10px;">
  57. <el-image
  58. style="width: 50px; height: 50px;border-radius: 5px;"
  59. :src="scope.row.user.avatar_url?scope.row.user.avatar_url:'/resources/img/common/default-avatar.png'">
  60. </el-image>
  61. </div>
  62. <div class="table-info-text">
  63. <div>{{scope.row.user.nickname}}</div>
  64. <div >{{scope.row.user.mobile}}</div>
  65. </div>
  66. </div>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="view_material" label="查看素材数量" align="left"></el-table-column>
  70. <el-table-column prop="view_times" label="观看总次数" align="left"></el-table-column>
  71. <el-table-column label="观看总时长" align="left">
  72. <template slot-scope="scope">
  73. {{scope.row.view_seconds|formatCountHour}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="成为客户时间" align="center">
  77. <template slot-scope="scope">
  78. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="最近观看时间" align="center">
  82. <template slot-scope="scope" v-if="scope.row.recent_time">
  83. {{scope.row.recent_time|dateTimeFormat('Y-m-d H:i:s')}}
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="操作" align="center" fixed="right" >
  87. <template slot-scope="scope">
  88. <el-button type="text" @click="handle('log',scope.row)">观看记录</el-button>
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. <div style="text-align: right;margin: 20px 0;">
  93. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  94. </div>
  95. </el-tabs>
  96. </div>
  97. </el-card>
  98. </div>
  99. <script>
  100. const app = new Vue({
  101. el: '#app',
  102. data: {
  103. loading: false,
  104. page: 1,
  105. pageCount: 0,
  106. list: [],
  107. searchForm:{
  108. user_id: null,
  109. nickname: null,
  110. recent_time: null,
  111. },
  112. level_list: [], // 等级列表
  113. status_option: [
  114. {index: 0, name: '待结算'},
  115. {index: 1, name: '已结算'},
  116. ],
  117. export_list: {},
  118. export_url: '/business-bonus/reward/index',
  119. },
  120. mounted() {
  121. this.getList();
  122. },
  123. computed: {
  124. show_clear_search_btn: function() {
  125. return this.searchForm.user_id != null ||
  126. this.searchForm.recent_time != null ||
  127. this.searchForm.nickname != null;
  128. },
  129. },
  130. methods: {
  131. pagination(currentPage) {
  132. let self = this;
  133. self.page = currentPage;
  134. self.getList(this.searchForm);
  135. },
  136. search() {// 清空查询条件
  137. this.page = 1;
  138. this.getList(this.searchForm);
  139. },
  140. resetSearch() {// 清空查询条件
  141. this.searchForm = {
  142. user_id: null,
  143. nickname: null,
  144. recent_time: null,
  145. };
  146. this.page = 1;
  147. this.getList();
  148. },
  149. switchFun(val, id, field) {
  150. if (field == 'status') {
  151. let param = {id: id, status: val};
  152. this.send('business-card/material-cate/handle',param)
  153. }
  154. },
  155. handle(type, data = null) {
  156. let id = data ? parseInt(data.id) : '';
  157. switch (type) {
  158. case 'log':
  159. let params = {
  160. r: 'business-card/material-browse/log'
  161. };
  162. if (id) params = Object.assign(params, {
  163. user_id: data.user_id
  164. });
  165. navigateTo(params);
  166. break;
  167. case 'detail':
  168. let param = {
  169. r: 'business-card/material-cate/detail'
  170. };
  171. if (id) param = Object.assign(param, {
  172. id: id
  173. });
  174. navigateTo(param);
  175. break;
  176. case 'destroy':
  177. let param2 = {id: data.id,status: -1};
  178. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {
  179. this.send('business-card/material-cate/handle',param2)
  180. })
  181. break;
  182. }
  183. },
  184. send(url, params, callback = null) {
  185. let self = this;
  186. request({
  187. params: {
  188. r: url,
  189. },
  190. method: 'post',
  191. data: params
  192. }).then(e => {
  193. if (e.data.code == 0) {
  194. self.$message.success(e.data.msg);
  195. self.getList();
  196. } else {
  197. self.$message.error(e.data.msg);
  198. }
  199. }).catch(e => {
  200. console.log(e);
  201. });
  202. if(callback) return e.data;
  203. },
  204. getList(search = {}) {
  205. let self = this;
  206. self.loading = true;
  207. let basic_params = {
  208. page: self.page,
  209. };
  210. let params = Object.assign(basic_params, search);
  211. request({
  212. params: {
  213. r: 'business-card/material-browse/index'
  214. },
  215. method: 'post',
  216. data: params
  217. }).then(e => {
  218. self.loading = false;
  219. if (e.data.code == 0) {
  220. self.list = e.data.data.list;
  221. console.log(self.list)
  222. self.pageCount = e.data.data.page_count;
  223. } else {
  224. self.$message.error(e.data.msg);
  225. }
  226. }).catch(e => {
  227. self.loading = false;
  228. });
  229. },
  230. getBusinessBonusLevel()
  231. {
  232. let self = this;
  233. request({
  234. params: {
  235. r: 'business-bonus/default/business-bonus-level'
  236. },
  237. method: 'post',
  238. data: {}
  239. }).then(e => {
  240. if (e.data.code == 0) {
  241. self.level_list = e.data.data.level_list;
  242. } else {
  243. self.$message.error(e.data.msg);
  244. }
  245. }).catch(e => {
  246. });
  247. }
  248. },
  249. filters: {
  250. formatCountHour(val) {
  251. if (val <= 0) {
  252. return '';
  253. }
  254. let dayAvg = 86400;
  255. let hourAvg = 3600;
  256. let minAvg = 60;
  257. let day = 0; //Math.floor(val / dayAvg);
  258. let hour = Math.floor((val - day * dayAvg) / hourAvg);
  259. let min = Math.floor((val - day * dayAvg - hour * hourAvg) / minAvg);
  260. let sec = Math.floor(val - day * dayAvg - hour * hourAvg - min * minAvg);
  261. let result = '';
  262. if (day) {
  263. day = day < 10 ? '0' + day : day;
  264. // result += day + '天';
  265. }
  266. if (hour) {
  267. hour = hour < 10 ? '0' + hour : hour;
  268. result += hour + '时';
  269. }
  270. if (min) {
  271. min = min < 10 ? '0' + min : min;
  272. result += min + '分';
  273. }
  274. if (sec) {
  275. sec = sec < 10 ? '0' + sec : sec;
  276. result += sec + '秒';
  277. }
  278. return result;
  279. }
  280. }
  281. });
  282. </script>
  283. <style>
  284. .el-tabs__header {
  285. font-size: 16px;
  286. }
  287. .table-body {
  288. padding: 20px;
  289. background-color: #fff;
  290. }
  291. .table-body .el-button {
  292. padding: 0 !important;
  293. border: 0;
  294. margin: 0 5px;
  295. }
  296. .input-item {
  297. width: 250px;
  298. margin: 0 0 20px;
  299. display: inline-block;
  300. }
  301. .input-item .el-input__inner {
  302. border-right: 0;
  303. }
  304. .input-item .el-input__inner:hover {
  305. border: 1px solid #dcdfe6;
  306. border-right: 0;
  307. outline: 0;
  308. }
  309. .input-item .el-input__inner:focus {
  310. border: 1px solid #dcdfe6;
  311. border-right: 0;
  312. outline: 0;
  313. }
  314. .input-item .el-input-group__append {
  315. background-color: #fff;
  316. border-left: 0;
  317. width: 10%;
  318. padding: 0;
  319. }
  320. .input-item .el-input-group__append .el-button {
  321. padding: 0;
  322. }
  323. .input-item .el-input-group__append .el-button {
  324. margin: 0;
  325. }
  326. .batch {
  327. margin: 0 0 20px;
  328. display: inline-block;
  329. }
  330. .batch .el-button {
  331. padding: 9px 15px !important;
  332. }
  333. .el-table th>.cell{
  334. color: #333;
  335. font-weight: bold;
  336. font-size: 14px;
  337. }
  338. .el-table__footer-wrapper, .el-table__header-wrapper{
  339. }
  340. .search-box {
  341. padding: 10px 0 0 10px;
  342. background-color: #fff;
  343. margin-bottom: 10px;
  344. }
  345. </style>