log.php 16 KB

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