<template>
|
<!--
|
作者:luoyiming
|
时间:2019-10-25
|
描述:门店列表
|
-->
|
<div class="user">
|
<!--添加门店-->
|
<!-- <div class="common-level-rail"><el-button size="small" type="primary" icon="el-icon-plus" @click="addClick" v-auth="'/store/store/add'">添加门店</el-button></div> -->
|
<!--搜索表单-->
|
<div class="common-seach-wrap">
|
<el-form size="small" :inline="true" :model="formInline" class="demo-form-inline">
|
<el-form-item>
|
<el-input size="small" v-model="formInline.search" placeholder="请输入用户昵称"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button size="small" type="primary" icon="el-icon-search" @click="searchSubmit">查询</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<!--内容-->
|
<div class="product-content">
|
<div class="table-wrap">
|
<el-table size="small" :data="tableData" border style="width: 100%" v-loading="loading">
|
<el-table-column prop="user_id" label="用户ID" width="160"></el-table-column>
|
<el-table-column prop="user.nickName" label="昵称" ></el-table-column>
|
<el-table-column label="头像" width="60">
|
<template slot-scope="scope">
|
<img v-img-url="scope.row.user.avatarUrl" width="30px" height="30px" />
|
</template>
|
</el-table-column>
|
<el-table-column prop="newMessage.create_time" label="最近聊天时间" width="140"></el-table-column>
|
<el-table-column prop="create_time" label="创建时间" width="140"></el-table-column>
|
<el-table-column fixed="right" label="操作" width="90">
|
<template slot-scope="scope">
|
<el-button @click="recordClick(scope.row)" type="text" size="small" v-auth="'/chat/chat/record'">对话记录</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<!--分页-->
|
<div class="pagination">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
background
|
:current-page="curPage"
|
:page-size="pageSize"
|
layout="total, prev, pager, next, jumper"
|
:total="totalDataNumber"
|
></el-pagination>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import ServiceApi from '@/api/service.js';
|
export default {
|
components: {},
|
inject: ['reload'],
|
data() {
|
return {
|
/*是否加载完成*/
|
loading: true,
|
/*列表数据*/
|
tableData: [],
|
/*一页多少条*/
|
pageSize: 20,
|
/*一共多少条数据*/
|
totalDataNumber: 0,
|
/*当前是第几页*/
|
curPage: 1,
|
/*横向表单数据模型*/
|
formInline: {
|
search: '',
|
},
|
/*是否打开添加弹窗*/
|
open_add: false,
|
/*是否打开编辑弹窗*/
|
open_edit: false,
|
/*当前编辑的对象*/
|
userModel: {}
|
};
|
},
|
created() {
|
/*获取列表*/
|
this.getTableList();
|
},
|
methods: {
|
/*搜索*/
|
searchSubmit() {
|
this.curPage = 1;
|
this.getTableList();
|
},
|
/*选择第几页*/
|
handleCurrentChange(val) {
|
let self = this;
|
self.curPage = val;
|
self.loading = true;
|
self.getTableList();
|
},
|
|
/*每页多少条*/
|
handleSizeChange(val) {
|
this.curPage = 1;
|
this.pageSize = val;
|
this.getTableList();
|
},
|
|
/*获取列表*/
|
getTableList() {
|
let self = this;
|
let Params = {};
|
Params.page = self.curPage;
|
Params.list_rows = self.pageSize;
|
Params.nickName = self.formInline.search;
|
ServiceApi.chatlist(Params, true)
|
.then(data => {
|
self.loading = false;
|
self.tableData = data.data.list.data;
|
self.totalDataNumber = data.data.list.total;
|
})
|
.catch(error => {});
|
},
|
|
/*打开添加*/
|
addClick() {
|
this.$router.push('/store/store/add');
|
},
|
|
/*打开编辑*/
|
recordClick(row) {
|
let self = this;
|
let params = row.user_id;
|
this.$router.push({
|
path: '/chat/chat/record',
|
query: {
|
user_id: params
|
}
|
});
|
},
|
|
/*删除*/
|
deleteClick(row) {
|
let self = this;
|
self
|
.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
ServiceApi.deleteShop(
|
{
|
store_id: row.store_id
|
},
|
true
|
)
|
.then(data => {
|
self.$message({
|
message: '恭喜你,门店删除成功',
|
type: 'success'
|
});
|
self.getTableList();
|
})
|
.catch(error => {});
|
})
|
.catch(() => {});
|
}
|
}
|
};
|
</script>
|
|
<style></style>
|