|
|
@@ -1,251 +1,289 @@
|
|
|
-<template>
|
|
|
- <div style="padding-top: 10px;">
|
|
|
- <i-page-header :title="pageTitle"></i-page-header>
|
|
|
- <Card :bordered="false" dis-hover class="ivu-mt">
|
|
|
- <!-- <Form ref="orderData" :model="orderData">
|
|
|
- <Row :gutter="24" type="flex">
|
|
|
- <Col>
|
|
|
- <FormItem label="UID:" label-for="uid">
|
|
|
- <Input placeholder="用户UID" v-model="orderData.uid"/>
|
|
|
- </FormItem>
|
|
|
- </Col>
|
|
|
- <Col>
|
|
|
- <FormItem label="绑定手机:" label-for="mobile">
|
|
|
- <Input placeholder="绑定手机号码" v-model="orderData.mobile"/>
|
|
|
- </FormItem>
|
|
|
- </Col>
|
|
|
- <Col>
|
|
|
- <FormItem label="购买时间:">
|
|
|
- <DatePicker v-model="orderData.time" format="yyyy/MM/dd HH:mm:ss" type="datetimerange" placement="bottom-start" placeholder="自定义时间" style="width: 300px;" class="mr20" :options="options"></DatePicker>
|
|
|
- </FormItem>
|
|
|
- </Col>
|
|
|
- <Col>
|
|
|
- <Button label="default" type="primary" icon="ios-search" class="mr15" style="margin-top: 32px;" @click="orderSearch()">搜索</Button>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </Form> -->
|
|
|
- <!-- <Col>
|
|
|
- <Button class="export" icon="ios-share-outline" @click="exports">导出</Button>
|
|
|
- </Col> -->
|
|
|
-
|
|
|
-
|
|
|
- <Table :columns="columns" :data="orderList" ref="table" :loading="loading" highlight-row no-data-text="暂无数据" no-filtered-data-text="暂无筛选结果" class="orderData mt25">
|
|
|
- <template slot-scope="{ row, index }" slot="order_id">
|
|
|
- <span v-text="row.order_id" style="display: block;"></span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row, index }" slot="uid">
|
|
|
- <div>{{row.nickname || '微信用户'}}[UID:{{row.uid}}]</div>
|
|
|
- <div>{{row.mobile || '未绑定手机号'}}</div>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row, index }" slot="imgs">
|
|
|
- <img v-if="row.imgs.length>0" v-lazy="row.imgs[0]" :src="row.imgs[0]" v-image-preview style="width: 60px;cursor: pointer"/>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template slot-scope="{ row, index }" slot="is_default">
|
|
|
- <el-tag type="success" size="mini" v-if="row.is_default == 1">默认模板</el-tag>
|
|
|
- </template>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- </Table>
|
|
|
- <div class="acea-row row-right page">
|
|
|
- <Page :total="page.count" show-elevator show-total @on-change="tapPage" :page-size="page.pageSize"/>
|
|
|
- </div>
|
|
|
- </Card>
|
|
|
-
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-<script>
|
|
|
- import IPageHeader from "../../../layouts/system/page-header/index";
|
|
|
- import {SystemShowTemplateList} from "../../../api/system/user";
|
|
|
- import { getRecordList } from '../../../api/system/chat'
|
|
|
-
|
|
|
- export default {
|
|
|
- name: "chatList",
|
|
|
- components: {SystemShowTemplateList,IPageHeader},
|
|
|
- computed: {},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- pageTitle:"聊天记录",
|
|
|
- options: {
|
|
|
- shortcuts: [
|
|
|
- {
|
|
|
- text: '今天',
|
|
|
- value() {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()));
|
|
|
- return [start, end];
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- text: '昨天',
|
|
|
- value() {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 1)));
|
|
|
- end.setTime(end.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate())));
|
|
|
- return [start, end];
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- text: '最近7天',
|
|
|
- value() {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 6)));
|
|
|
- return [start, end];
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- text: '最近30天',
|
|
|
- value() {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 29)));
|
|
|
- return [start, end];
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- text: '本月',
|
|
|
- value() {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), 1)));
|
|
|
- return [start, end];
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- text: '本年',
|
|
|
- value() {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.setTime(new Date(new Date().getFullYear(), 0, 1)));
|
|
|
- return [start, end];
|
|
|
- }
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
-
|
|
|
- orderData: {
|
|
|
- uid : "",
|
|
|
- status : "all",
|
|
|
- time : [],
|
|
|
- mobile : "",
|
|
|
- show_template_id:"",
|
|
|
- },
|
|
|
- columns: [
|
|
|
- {
|
|
|
- title: 'ID',
|
|
|
- align: 'center',
|
|
|
- key: 'id',
|
|
|
- align:'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '发送人',
|
|
|
- slot: 'uid',
|
|
|
- align:'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '接收人',
|
|
|
- slot: 'to_uid',
|
|
|
- align:'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '聊天图片',
|
|
|
- align: 'center',
|
|
|
- slot: 'imgs',
|
|
|
- align:'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '内容',
|
|
|
- align: 'center',
|
|
|
- key: 'content',
|
|
|
- align:'left'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '时间',
|
|
|
- align: 'center',
|
|
|
- key: 'add_time',
|
|
|
- align:'left'
|
|
|
- },
|
|
|
- ],
|
|
|
- loading:false,
|
|
|
- orderList:[],
|
|
|
- orderDatalist:{},
|
|
|
- orderId : 0,
|
|
|
- page: {
|
|
|
- total: 0, // 总条数
|
|
|
- page: 1, // 当前页
|
|
|
- pageSize: 10 // 每页显示条数
|
|
|
- },
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- created() {
|
|
|
- if(this.$route.query.title){
|
|
|
- this.pageTitle = this.$route.query.title;
|
|
|
- }
|
|
|
- if(this.$route.query.uid){
|
|
|
- this.orderData.uid = parseInt(this.$route.query.uid);
|
|
|
- }
|
|
|
- if(this.$route.query.show_template_id){
|
|
|
- this.orderData.show_template_id = parseInt(this.$route.query.show_template_id);
|
|
|
- }
|
|
|
- this.initView();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- /**
|
|
|
- * 基本数据
|
|
|
- */
|
|
|
- initView: function () {
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- tabsHandleClick:function(tab, event){
|
|
|
- this.page.page = 1;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- orderSearch:function(){
|
|
|
- this.page.page = 1;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- /**
|
|
|
- * 分页
|
|
|
- */
|
|
|
- tapPage:function(index){
|
|
|
- this.page.page = index;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- /**
|
|
|
- * 获取数据
|
|
|
- */
|
|
|
- getData:function () {
|
|
|
- var that =this;
|
|
|
- // this.loading = true;
|
|
|
- var data = {
|
|
|
- page :that.page.page,
|
|
|
- ...that.orderData
|
|
|
- };
|
|
|
- getRecordList(data)
|
|
|
- .then(res=>{
|
|
|
- that.loading = false;
|
|
|
- if(res.code == 200) {
|
|
|
- that.orderList = res.data.list;
|
|
|
- that.page.pageSize = res.data.pageSize;
|
|
|
- that.page.count = res.data.pageCount;
|
|
|
- } else {
|
|
|
- that.$alert(res.msg);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(err=>{
|
|
|
- that.loading = false;
|
|
|
- that.$alert("网络繁忙,加载失败,请稍等片刻在尝试!", '系统提示');
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <div style="padding-top: 10px;">
|
|
|
+ <i-page-header :title="pageTitle"></i-page-header>
|
|
|
+ <Card :bordered="false" dis-hover class="ivu-mt">
|
|
|
+ <Form ref="orderData" :model="orderData">
|
|
|
+ <Row :gutter="24" type="flex">
|
|
|
+ <Col>
|
|
|
+ <FormItem label="发送人:" label-for="user_id">
|
|
|
+ <Input placeholder="发送人" v-model="orderData.user_id"/>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col>
|
|
|
+ <FormItem label="接收人:" label-for="to_user_id">
|
|
|
+ <Input placeholder="接收人" v-model="orderData.to_user_id"/>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col>
|
|
|
+ <FormItem label="类型:" label-for="type">
|
|
|
+ <el-select v-model="orderData.type" placeholder="请选择">
|
|
|
+ <el-option value="1" label="文本"></el-option>
|
|
|
+ <el-option value="3" label="图片"></el-option>
|
|
|
+ </el-select >
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col>
|
|
|
+ <FormItem label="是否已读:" label-for="is_read">
|
|
|
+ <el-select v-model="orderData.is_read" placeholder="请选择">
|
|
|
+ <el-option value="1" label="已读"></el-option>
|
|
|
+ <el-option value="0" label="未读"></el-option>
|
|
|
+ </el-select >
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <!-- <Col>
|
|
|
+ <FormItem label="购买时间:">
|
|
|
+ <DatePicker v-model="orderData.time" format="yyyy/MM/dd HH:mm:ss" type="datetimerange" placement="bottom-start" placeholder="自定义时间" style="width: 300px;" class="mr20" :options="options"></DatePicker>
|
|
|
+ </FormItem>
|
|
|
+ </Col> -->
|
|
|
+ <Col>
|
|
|
+ <Button label="default" type="primary" icon="ios-search" class="mr15" style="margin-top: 32px;" @click="orderSearch()">搜索</Button>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form>
|
|
|
+ <!-- <Col>
|
|
|
+ <Button class="export" icon="ios-share-outline" @click="exports">导出</Button>
|
|
|
+ </Col> -->
|
|
|
+
|
|
|
+
|
|
|
+ <Table :columns="columns" :data="orderList" ref="table" :loading="loading" highlight-row no-data-text="暂无数据"
|
|
|
+ no-filtered-data-text="暂无筛选结果" class="orderData mt25">
|
|
|
+ <template slot-scope="{ row, index }" slot="order_id">
|
|
|
+ <span v-text="row.order_id" style="display: block;"></span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="user_id">
|
|
|
+ <div>{{row.nickname || '微信用户'}}( UID:{{row.uid}} )</div>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="to_user_id">
|
|
|
+ <div>{{row.nickname || '微信用户'}}( UID:{{row.to_user_id}} )</div>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="type">
|
|
|
+ <!-- 1 文本 2语音 3图片 -->
|
|
|
+ <el-tag v-if="row.type==1" type="success">文本</el-tag>
|
|
|
+ <el-tag v-if="row.type==2" type="success">语音</el-tag>
|
|
|
+ <el-tag v-if="row.type==3" type="success">图片</el-tag>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="is_read">
|
|
|
+ <el-tag v-if="row.is_read == 1" type="success">已读</el-tag>
|
|
|
+ <el-tag v-if="row.is_read == 0" type="danger">未读</el-tag>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="content">
|
|
|
+
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot-scope="{ row, index }" slot="is_default">
|
|
|
+ <el-tag type="success" size="mini" v-if="row.is_default == 1">默认模板</el-tag>
|
|
|
+ </template>
|
|
|
+ </Table>
|
|
|
+ <div class="acea-row row-right page">
|
|
|
+ <Page :total="page.count" show-elevator show-total @on-change="tapPage" :page-size="page.pageSize" />
|
|
|
+ </div>
|
|
|
+ </Card>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ import IPageHeader from "../../../layouts/system/page-header/index";
|
|
|
+ import {
|
|
|
+ SystemShowTemplateList
|
|
|
+ } from "../../../api/system/user";
|
|
|
+ import {
|
|
|
+ getRecordList
|
|
|
+ } from '../../../api/system/chat'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "chatList",
|
|
|
+ components: {
|
|
|
+ SystemShowTemplateList,
|
|
|
+ IPageHeader
|
|
|
+ },
|
|
|
+ computed: {},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ pageTitle: "聊天记录",
|
|
|
+ options: {
|
|
|
+ shortcuts: [{
|
|
|
+ text: '今天',
|
|
|
+ value() {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date()
|
|
|
+ .getDate()));
|
|
|
+ return [start, end];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '昨天',
|
|
|
+ value() {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
|
|
|
+ new Date().getDate() - 1)));
|
|
|
+ end.setTime(end.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
|
|
|
+ new Date().getDate())));
|
|
|
+ return [start, end];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '最近7天',
|
|
|
+ value() {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
|
|
|
+ new Date().getDate() - 6)));
|
|
|
+ return [start, end];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '最近30天',
|
|
|
+ value() {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
|
|
|
+ new Date().getDate() - 29)));
|
|
|
+ return [start, end];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '本月',
|
|
|
+ value() {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(),
|
|
|
+ 1)));
|
|
|
+ return [start, end];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '本年',
|
|
|
+ value() {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.setTime(new Date(new Date().getFullYear(), 0, 1)));
|
|
|
+ return [start, end];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+
|
|
|
+ orderData: {
|
|
|
+ uid: "",
|
|
|
+ status: "",
|
|
|
+ is_read: '1',
|
|
|
+ type: '1'
|
|
|
+ },
|
|
|
+ columns: [{
|
|
|
+ title: 'ID',
|
|
|
+ align: 'center',
|
|
|
+ key: 'id',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '发送人',
|
|
|
+ slot: 'user_id',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '接收人',
|
|
|
+ slot: 'to_user_id',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '类型',
|
|
|
+ slot: 'type',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '内容',
|
|
|
+ slot: 'content',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '是否已读',
|
|
|
+ slot: 'is_read',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '时间',
|
|
|
+ key: 'add_time',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ loading: false,
|
|
|
+ orderList: [],
|
|
|
+ orderDatalist: {},
|
|
|
+ orderId: 0,
|
|
|
+ page: {
|
|
|
+ total: 0, // 总条数
|
|
|
+ page: 1, // 当前页
|
|
|
+ pageSize: 10 // 每页显示条数
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ if (this.$route.query.title) {
|
|
|
+ this.pageTitle = this.$route.query.title;
|
|
|
+ }
|
|
|
+ if (this.$route.query.uid) {
|
|
|
+ this.orderData.uid = parseInt(this.$route.query.uid);
|
|
|
+ }
|
|
|
+ if (this.$route.query.show_template_id) {
|
|
|
+ this.orderData.show_template_id = parseInt(this.$route.query.show_template_id);
|
|
|
+ }
|
|
|
+ this.initView();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /**
|
|
|
+ * 基本数据
|
|
|
+ */
|
|
|
+ initView: function() {
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ tabsHandleClick: function(tab, event) {
|
|
|
+ this.page.page = 1;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ orderSearch: function() {
|
|
|
+ this.page.page = 1;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 分页
|
|
|
+ */
|
|
|
+ tapPage: function(index) {
|
|
|
+ this.page.page = index;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取数据
|
|
|
+ */
|
|
|
+ getData: function() {
|
|
|
+ var that = this;
|
|
|
+ // this.loading = true;
|
|
|
+ var data = {
|
|
|
+ page: that.page.page,
|
|
|
+ limit: that.page.pageSize,
|
|
|
+ ...that.orderData
|
|
|
+ };
|
|
|
+ getRecordList(data)
|
|
|
+ .then(res => {
|
|
|
+ that.loading = false;
|
|
|
+ if (res.code == 200) {
|
|
|
+ that.orderList = res.data.list;
|
|
|
+ that.page.count = res.data.total;
|
|
|
+ } else {
|
|
|
+ that.$alert(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ that.loading = false;
|
|
|
+ that.$alert("网络繁忙,加载失败,请稍等片刻在尝试!", '系统提示');
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|