index.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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.material_id"></el-input>
  28. </el-form-item>
  29. <el-form-item label="素材标题">
  30. <el-input placeholder="请输入素材标题" v-model="searchForm.title"></el-input>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button type="primary" @click="search">搜索</el-button>
  34. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  35. </el-form-item>
  36. </el-form>
  37. </div>
  38. <div class="table-body">
  39. <el-tabs>
  40. <el-table :data="list" border v-loading="loading" size="small" style="margin-bottom: 15px;">
  41. <el-table-column prop="material_id" label="素材ID" align="center" width="80"></el-table-column>
  42. <el-table-column align="left" label="素材封面" width="80">
  43. <template slot-scope="scope" v-if="scope.row.material">
  44. <div flex="cross:center">
  45. <div style="margin-right: 10px;">
  46. <el-image
  47. style="width: 50px; height: 50px;border-radius: 5px;"
  48. :src="scope.row.material.cover_img">
  49. </el-image>
  50. </div>
  51. </div>
  52. </template>
  53. </el-table-column>
  54. <el-table-column align="left" label="素材标题" min-width="100">
  55. <template slot-scope="scope" v-if="scope.row.material">
  56. {{scope.row.material.title}}
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="share_times" label="分享次数" align="left"></el-table-column>
  60. <el-table-column prop="view_numbers" label="观看人数" align="left"></el-table-column>
  61. <el-table-column prop="view_times" label="观看次数" align="left"></el-table-column>
  62. <el-table-column label="浏览总时长" align="left">
  63. <template slot-scope="scope">
  64. {{scope.row.view_seconds|formatCountHour}}
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <div style="text-align: right;margin: 20px 0;">
  69. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  70. </div>
  71. </el-tabs>
  72. </div>
  73. </el-card>
  74. </div>
  75. <script>
  76. const app = new Vue({
  77. el: '#app',
  78. data: {
  79. loading: false,
  80. page: 1,
  81. pageCount: 0,
  82. list: [],
  83. searchForm:{
  84. material_id: null,
  85. title: null,
  86. },
  87. level_list: [], // 等级列表
  88. status_option: [
  89. {index: 0, name: '待结算'},
  90. {index: 1, name: '已结算'},
  91. ],
  92. export_list: {},
  93. export_url: '/business-bonus/reward/index',
  94. },
  95. mounted() {
  96. this.getList();
  97. },
  98. computed: {
  99. show_clear_search_btn: function() {
  100. return this.searchForm.material_id != null ||
  101. this.searchForm.title != null;
  102. },
  103. },
  104. methods: {
  105. pagination(currentPage) {
  106. let self = this;
  107. self.page = currentPage;
  108. self.getList(this.searchForm);
  109. },
  110. search() {// 清空查询条件
  111. this.page = 1;
  112. this.getList(this.searchForm);
  113. },
  114. resetSearch() {// 清空查询条件
  115. this.searchForm = {
  116. material_id: null,
  117. title: null,
  118. };
  119. this.page = 1;
  120. this.getList();
  121. },
  122. switchFun(val, id, field) {
  123. if (field == 'status') {
  124. let param = {id: id, status: val};
  125. this.send('business-card/material-cate/handle',param)
  126. }
  127. },
  128. handle(type, data = null) {
  129. let id = data ? parseInt(data.id) : '';
  130. switch (type) {
  131. case 'log':
  132. let params = {
  133. r: 'business-card/material-browse/log'
  134. };
  135. if (id) params = Object.assign(params, {
  136. user_id: data.user_id
  137. });
  138. navigateTo(params);
  139. break;
  140. case 'detail':
  141. let param = {
  142. r: 'business-card/material-cate/detail'
  143. };
  144. if (id) param = Object.assign(param, {
  145. id: id
  146. });
  147. navigateTo(param);
  148. break;
  149. case 'destroy':
  150. let param2 = {id: data.id,status: -1};
  151. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {
  152. this.send('business-card/material-cate/handle',param2)
  153. })
  154. break;
  155. }
  156. },
  157. send(url, params, callback = null) {
  158. let self = this;
  159. request({
  160. params: {
  161. r: url,
  162. },
  163. method: 'post',
  164. data: params
  165. }).then(e => {
  166. if (e.data.code == 0) {
  167. self.$message.success(e.data.msg);
  168. self.getList();
  169. } else {
  170. self.$message.error(e.data.msg);
  171. }
  172. }).catch(e => {
  173. console.log(e);
  174. });
  175. if(callback) return e.data;
  176. },
  177. getList(search = {}) {
  178. let self = this;
  179. self.loading = true;
  180. let basic_params = {
  181. page: self.page,
  182. };
  183. let params = Object.assign(basic_params, search);
  184. request({
  185. params: {
  186. r: 'business-card/material-statistics/index'
  187. },
  188. method: 'post',
  189. data: params
  190. }).then(e => {
  191. self.loading = false;
  192. if (e.data.code == 0) {
  193. self.list = e.data.data.list;
  194. console.log(self.list)
  195. self.pageCount = e.data.data.page_count;
  196. } else {
  197. self.$message.error(e.data.msg);
  198. }
  199. }).catch(e => {
  200. self.loading = false;
  201. });
  202. },
  203. getBusinessBonusLevel()
  204. {
  205. let self = this;
  206. request({
  207. params: {
  208. r: 'business-bonus/default/business-bonus-level'
  209. },
  210. method: 'post',
  211. data: {}
  212. }).then(e => {
  213. if (e.data.code == 0) {
  214. self.level_list = e.data.data.level_list;
  215. } else {
  216. self.$message.error(e.data.msg);
  217. }
  218. }).catch(e => {
  219. });
  220. }
  221. },
  222. filters: {
  223. formatCountHour(val) {
  224. if (val <= 0) {
  225. return '';
  226. }
  227. let dayAvg = 86400;
  228. let hourAvg = 3600;
  229. let minAvg = 60;
  230. let day = 0; //Math.floor(val / dayAvg);
  231. let hour = Math.floor((val - day * dayAvg) / hourAvg);
  232. let min = Math.floor((val - day * dayAvg - hour * hourAvg) / minAvg);
  233. let sec = Math.floor(val - day * dayAvg - hour * hourAvg - min * minAvg);
  234. let result = '';
  235. if (day) {
  236. day = day < 10 ? '0' + day : day;
  237. // result += day + '天';
  238. }
  239. if (hour) {
  240. hour = hour < 10 ? '0' + hour : hour;
  241. result += hour + '时';
  242. }
  243. if (min) {
  244. min = min < 10 ? '0' + min : min;
  245. result += min + '分';
  246. }
  247. if (sec) {
  248. sec = sec < 10 ? '0' + sec : sec;
  249. result += sec + '秒';
  250. }
  251. return result;
  252. }
  253. }
  254. });
  255. </script>
  256. <style>
  257. .el-tabs__header {
  258. font-size: 16px;
  259. }
  260. .table-body {
  261. padding: 20px;
  262. background-color: #fff;
  263. }
  264. .table-body .el-button {
  265. padding: 0 !important;
  266. border: 0;
  267. margin: 0 5px;
  268. }
  269. .input-item {
  270. width: 250px;
  271. margin: 0 0 20px;
  272. display: inline-block;
  273. }
  274. .input-item .el-input__inner {
  275. border-right: 0;
  276. }
  277. .input-item .el-input__inner:hover {
  278. border: 1px solid #dcdfe6;
  279. border-right: 0;
  280. outline: 0;
  281. }
  282. .input-item .el-input__inner:focus {
  283. border: 1px solid #dcdfe6;
  284. border-right: 0;
  285. outline: 0;
  286. }
  287. .input-item .el-input-group__append {
  288. background-color: #fff;
  289. border-left: 0;
  290. width: 10%;
  291. padding: 0;
  292. }
  293. .input-item .el-input-group__append .el-button {
  294. padding: 0;
  295. }
  296. .input-item .el-input-group__append .el-button {
  297. margin: 0;
  298. }
  299. .batch {
  300. margin: 0 0 20px;
  301. display: inline-block;
  302. }
  303. .batch .el-button {
  304. padding: 9px 15px !important;
  305. }
  306. .el-table th>.cell{
  307. color: #333;
  308. font-weight: bold;
  309. font-size: 14px;
  310. }
  311. .el-table__footer-wrapper, .el-table__header-wrapper{
  312. }
  313. .search-box {
  314. padding: 10px 0 0 10px;
  315. background-color: #fff;
  316. margin-bottom: 10px;
  317. }
  318. </style>