| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-export-dialog');
- ?>
- <style>
- .link_url {
- text-align: left;
- font-size: 14px;
- }
- .showqr .el-dialog__body {
- text-align: center;
- padding-bottom: 10px;
- }
- .el-dialog {
- min-width: 400px;
- }
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>客户管理</span>
- </div>
- <div class="search-box">
- <!-- 搜索 -->
- <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
- <el-form-item label="客户ID">
- <el-input placeholder="请输入客户ID" v-model="searchForm.user_id"></el-input>
- </el-form-item>
- <el-form-item label="客户">
- <el-input placeholder="请输入昵称/手机号" v-model="searchForm.nickname"></el-input>
- </el-form-item>
- <el-form-item label="最近观看时间">
- <el-date-picker
- size="small"
- v-model="searchForm.recent_time"
- type="datetimerange"
- value-format="yyyy-MM-dd HH:mm:ss"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="search">搜索</el-button>
- <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
- </el-form-item>
- </el-form>
- </div>
- <div class="table-body">
- <el-tabs>
- <el-table :data="list" border v-loading="loading" size="small" style="margin-bottom: 15px;">
- <el-table-column prop="user_id" label="客户ID" align="center"></el-table-column>
- <el-table-column align="left" label="客户" :show-overflow-tooltip="true" min-width="100">
- <template slot-scope="scope" v-if="scope.row.user">
- <div flex="cross:center">
- <div style="margin-right: 10px;">
- <el-image
- style="width: 50px; height: 50px;border-radius: 5px;"
- :src="scope.row.user.avatar_url?scope.row.user.avatar_url:'/resources/img/common/default-avatar.png'">
- </el-image>
- </div>
- <div class="table-info-text">
- <div>{{scope.row.user.nickname}}</div>
- <div >{{scope.row.user.mobile}}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="view_material" label="查看素材数量" align="left"></el-table-column>
- <el-table-column prop="view_times" label="观看总次数" align="left"></el-table-column>
- <el-table-column label="观看总时长" align="left">
- <template slot-scope="scope">
- {{scope.row.view_seconds|formatCountHour}}
- </template>
- </el-table-column>
- <el-table-column label="成为客户时间" align="center">
- <template slot-scope="scope">
- {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column label="最近观看时间" align="center">
- <template slot-scope="scope" v-if="scope.row.recent_time">
- {{scope.row.recent_time|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" fixed="right" >
- <template slot-scope="scope">
- <el-button type="text" @click="handle('log',scope.row)">观看记录</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: right;margin: 20px 0;">
- <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
- </div>
- </el-tabs>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- loading: false,
- page: 1,
- pageCount: 0,
- list: [],
- searchForm:{
- user_id: null,
- nickname: null,
- recent_time: null,
- },
- level_list: [], // 等级列表
- status_option: [
- {index: 0, name: '待结算'},
- {index: 1, name: '已结算'},
- ],
- export_list: {},
- export_url: '/business-bonus/reward/index',
- },
- mounted() {
- this.getList();
- },
- computed: {
- show_clear_search_btn: function() {
- return this.searchForm.user_id != null ||
- this.searchForm.recent_time != null ||
- this.searchForm.nickname != null;
- },
- },
- methods: {
- pagination(currentPage) {
- let self = this;
- self.page = currentPage;
- self.getList(this.searchForm);
- },
- search() {// 清空查询条件
- this.page = 1;
- this.getList(this.searchForm);
- },
- resetSearch() {// 清空查询条件
- this.searchForm = {
- user_id: null,
- nickname: null,
- recent_time: null,
- };
- this.page = 1;
- this.getList();
- },
- switchFun(val, id, field) {
- if (field == 'status') {
- let param = {id: id, status: val};
- this.send('business-card/material-cate/handle',param)
- }
- },
- handle(type, data = null) {
- let id = data ? parseInt(data.id) : '';
- switch (type) {
- case 'log':
- let params = {
- r: 'business-card/material-browse/log'
- };
- if (id) params = Object.assign(params, {
- user_id: data.user_id
- });
- navigateTo(params);
- break;
- case 'detail':
- let param = {
- r: 'business-card/material-cate/detail'
- };
- if (id) param = Object.assign(param, {
- id: id
- });
- navigateTo(param);
- break;
- case 'destroy':
- let param2 = {id: data.id,status: -1};
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {
- this.send('business-card/material-cate/handle',param2)
- })
- break;
- }
- },
- send(url, params, callback = null) {
- let self = this;
- request({
- params: {
- r: url,
- },
- method: 'post',
- data: params
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- if(callback) return e.data;
- },
- getList(search = {}) {
- let self = this;
- self.loading = true;
- let basic_params = {
- page: self.page,
- };
- let params = Object.assign(basic_params, search);
- request({
- params: {
- r: 'business-card/material-browse/index'
- },
- method: 'post',
- data: params
- }).then(e => {
- self.loading = false;
- if (e.data.code == 0) {
- self.list = e.data.data.list;
- console.log(self.list)
- self.pageCount = e.data.data.page_count;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.loading = false;
- });
- },
- getBusinessBonusLevel()
- {
- let self = this;
- request({
- params: {
- r: 'business-bonus/default/business-bonus-level'
- },
- method: 'post',
- data: {}
- }).then(e => {
- if (e.data.code == 0) {
- self.level_list = e.data.data.level_list;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- });
- }
- },
- filters: {
- formatCountHour(val) {
- if (val <= 0) {
- return '';
- }
- let dayAvg = 86400;
- let hourAvg = 3600;
- let minAvg = 60;
- let day = 0; //Math.floor(val / dayAvg);
- let hour = Math.floor((val - day * dayAvg) / hourAvg);
- let min = Math.floor((val - day * dayAvg - hour * hourAvg) / minAvg);
- let sec = Math.floor(val - day * dayAvg - hour * hourAvg - min * minAvg);
- let result = '';
- if (day) {
- day = day < 10 ? '0' + day : day;
- // result += day + '天';
- }
- if (hour) {
- hour = hour < 10 ? '0' + hour : hour;
- result += hour + '时';
- }
- if (min) {
- min = min < 10 ? '0' + min : min;
- result += min + '分';
- }
- if (sec) {
- sec = sec < 10 ? '0' + sec : sec;
- result += sec + '秒';
- }
- return result;
- }
- }
- });
- </script>
- <style>
- .el-tabs__header {
- font-size: 16px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .input-item {
- width: 250px;
- margin: 0 0 20px;
- display: inline-block;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .batch {
- margin: 0 0 20px;
- display: inline-block;
- }
- .batch .el-button {
- padding: 9px 15px !important;
- }
- .el-table th>.cell{
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper{
- }
- .search-box {
- padding: 10px 0 0 10px;
- background-color: #fff;
- margin-bottom: 10px;
- }
- </style>
|