| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <style>
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .input-item {
- display: inline-block;
- width: 250px;
- margin: 0 0 20px;
- }
- .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;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .el-table th > .cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- .label {
- margin-right: 10px;
- }
- .default-goods{
- max-width: 50px;
- max-height: 50px;
- }
- .flex-x-between {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-pack: space-between;
- -webkit-justify-content: space-between;
- -ms-flex-pack: space-between;
- justify-content: space-between;
- }
- .cont-title {
- font-size: 15px;
- padding-top: 20px;
- padding-bottom: 10px;
- font-weight: 700;
- }
- .cont-num {
- font-size: 14px;
- font-weight: 700;
- padding-bottom: 10px;
- }
- .center {
- text-align: center;
- }
- .el-dialog__header .el-dialog__title{
- font-size: 18px;
- }
- .el-dialog__wrapper .el-dialog__body{
- padding: 3px 20px;
- }
- /*头像样式 start*/
- .default-avatar{
- width: 50px;
- height: 50px;
- border-radius: 50%;
- }
- .user_img{
- position: relative;
- margin-right: 8px;
- height: 50px;
- width: 50px;
- }
- .el-table_1_column_2 .cell { /*-2 表示在第二行*/
- display: flex;
- }
- /*头像样式 end*/
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <div>
- <span>种草管理</span>
- </div>
- </template>
- </div>
- <div class="table-body el-input--small">
- <el-form size="small" :inline="true" flex="dir:left cross:center" style="margin-bottom: 12px;">
- <div class="item-box" flex="dir:left cross:center">
- <div class="label">创建时间</div>
- <el-date-picker
- v-model="time"
- type="datetimerange"
- value-format="yyyy-MM-dd HH:mm:ss"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </div>
- <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px; margin-left: 20px;">
- <div class="label">会员ID</div>
- <el-input style="width: 80px" v-model="search.user_id" placeholder="会员ID"></el-input>
- </div>
- <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
- <div class="label">会员昵称</div>
- <el-input style="width: 150px" v-model="search.user_name" placeholder="会员昵称"></el-input>
- </div>
- <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
- <div class="label">标题</div>
- <el-input style="width: 150px" v-model="search.title" placeholder="标题"></el-input>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <el-button type="primary" style="padding: 12px 34px !important;" @click="searchs">搜索
- </el-button>
- </div>
- </el-form>
- <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
- <el-table-column label="会员ID" min-width="80" align="center">
- <template slot-scope="scope">
- <div style="font-size: 13px;" v-if="scope.row.user_id>0">{{scope.row.user_id}}</div>
- <div style="font-size: 13px;color: red;" v-else>0</div>
- </template>
- </el-table-column>
- <el-table-column label="会员" width="180" >
- <template slot-scope="scope">
- <div class="user_img" v-if="scope.row.user_id>0">
- <el-image class="default-avatar" :src="scope.row.user.avatar_url">
- <div slot="error" class="image-slot">
- <com-image src="/resources/img/common/default-avatar.png"></com-image>
- </div>
- </el-image>
- </div>
- <div class="user_img" v-else>
- <el-image class="default-avatar" :src="scope.row.user_avatar_url">
- <div slot="error" class="image-slot">
- <com-image src="/resources/img/common/default-avatar.png"></com-image>
- </div>
- </el-image>
- </div>
- <div>
- <div style="color:#000;" v-if="scope.row.user_id>0">{{scope.row.user.nickname}}</div>
- <div style="color:#000;" v-else>{{scope.row.user_name}}</div>
- <div style="font-size: 13px;" v-if="scope.row.user_id>0">{{scope.row.user.mobile}}</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="标题" min-width="80" align="center">
- <template slot-scope="scope">
- <p>{{scope.row.title}}</p>
- </template>
- </el-table-column>
- <el-table-column label="分类" min-width="80" align="center">
- <template slot-scope="scope">
- <p>{{scope.row.cate.name}}</p>
- </template>
- </el-table-column>
-
- <el-table-column label="关联商品" width="250" >
- <template slot-scope="scope">
- <div v-if="scope.row.goods != ''&& scope.row.goods != null">
- <div style="float: left; width:60px">
- <img width='60px' height='60px'
- style="float: left;"
- v-if="scope.row.goods.cover_pic"
- :src="scope.row.goods.cover_pic"
- />
- </div>
- <div style="float: left; width: 50%;margin-left: 10px; text-align: left;">
- <com-ellipsis :line="1" :title="scope.row.goods.goods_name">{{scope.row.goods.goods_name}}</com-ellipsis>
- <p style="color: red;">¥{{scope.row.goods.price}}</p>
- </div>
- </div>
- <samp v-else>--</samp>
- </template>
- </el-table-column>
- <el-table-column label="浏览数" min-width="80" align="center">
- <template slot-scope="scope">
- <p>{{scope.row.views_count}}</p>
- </template>
- </el-table-column>
- <el-table-column label="点赞数" min-width="80" align="center">
- <template slot-scope="scope">
- <p>{{scope.row.stars_count}}</p>
- </template>
- </el-table-column>
- <el-table-column label="启用状态" min-width="80" align="center">
- <template slot-scope="scope">
- <el-switch active-value="1" inactive-value="0" @change="handle('enable',scope.row)"
- v-model="scope.row.status + ''">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="scope" width="160" label="创建时间">
- <template slot-scope="scope">
- {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- min-width="180"
- align="center">
- <template slot-scope="scope">
- <el-button circle size="mini" type="text" @click="detail(scope.row)">
- 查看
- </el-button>
- <el-button circle size="mini" type="text" @click="handle('delete',scope.row)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: right;margin: 20px 0;">
- <el-pagination v-if="pagination" :page-size="pagination.pageSize"
- style="display: inline-block;float: right;" background @current-change="pageChange"
- layout="prev, pager, next" :total="pagination.total_count">
- </el-pagination>
- </div>
- </div>
- </el-card>
- <!-- “数据”弹窗 -->
- <!-- <el-dialog title="数据(数据更新于2021-02-12 12:11)" :visible.sync="dialogFormVisible"> -->
- <el-dialog title="数据详情" :visible.sync="dialogFormVisible" >
- <div class="flex-x-between">
- <div>种草:{{data_list.title}}</div>
- <div style="color: #999;" v-if="data_list.created_at">
- 发布时间:{{data_list.created_at | dateTimeFormat("Y-m-d H:i:s")}}
- </div>
- </div>
- <div class="dialog-cont">
- <div class="cont-title">基本信息</div>
- <el-row :gutter="20" style="padding: 0px 10px;">
- <dl>正文:<span style="margin-left: 20px;">{{data_list.main_text}}</span></dl>
- </el-row>
- <el-row :gutter="20" style="padding: 0px 10px;">
- <div style="float: left" v-if="data_list && data_list.source.type == 1">图片:</div>
- <div style="float: left" v-else>视频:</div>
- <div style="float: left;margin-left: 20px;">
- <div v-if="data_list && data_list.source.type == 1" class="demo-image__preview">
- <el-image v-for="item in data_list.source.source" style="width: 80px; height: 80px;margin-left: 10px;" :src="item" :preview-src-list="data_list.source.source"> </el-image>
- </div>
- <div v-else>
- <video ref="videoPlayer" controls :src="data_list.source.source" :poster="data_list.source.source" controlslist="nodownload" style="width: 50%; height: 50%; object-fit: fill">
- </video>
- </div>
- </div>
- </el-row>
- </div>
- <div class="dialog-cont" :data="data_list">
- <div class="cont-title">互动数据</div>
- <el-row :gutter="20" style="padding: 10px 0">
- <el-col :span="6">
- <div class="cont-num center">{{data_list.shares_count}}</div>
- <div class="center">分享次数</div>
- </el-col>
- <el-col :span="6">
- <div class="cont-num center">{{data_list.views_count}}</div>
- <div class="center">浏览数</div>
- </el-col>
- <el-col :span="6">
- <div class="cont-num center">{{data_list.discuss_count}}</div>
- <div class="center">评论人数</div>
- </el-col>
- <el-col :span="6">
- <div class="cont-num center">{{data_list.stars_count}}</div>
- <div class="center">点赞数</div>
- </el-col>
- </el-row>
- </div>
- <div class="dialog-cont">
- <div class="cont-title">商品数据</div>
- <el-table :data = "goods_data" height="250" style="width: 100%" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}">
- <el-table-column label="商品名称" align="center">
- <template slot-scope="scope">
- <div v-if="scope.row.goods != ''&& scope.row.goods != null">
- <div style="float: left; width:60px">
- <img width='60px' height='60px'
- style="float: left;"
- v-if="scope.row.goods.cover_pic"
- :src="scope.row.goods.cover_pic"
- />
- </div>
- <div style="float: left; width: 50%;margin-left: 10px; text-align: left;">
- <com-ellipsis :line="1" :title="scope.row.goods.goods_name">{{scope.row.goods.goods_name}}</com-ellipsis>
- <p style="color: red;">¥{{scope.row.goods.price}}</p>
- </div>
- </div>
- <samp v-else>--</samp>
- </template>
- </el-table-column>
- <el-table-column prop="view_number" label="商品访问人数" width="180">
- <template slot-scope="scope">
- <span :title="scope.row.view_number" class="">{{scope.row.goods_views_count}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="bought_number" label="成交人数">
- <template slot-scope="scope">
- <span :title="scope.row.bought_number" class="">{{scope.row.order_count}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="amount" label="成交金额">
- <template slot-scope="scope">
- <span :title="scope.row.amount" class="">{{scope.row.goods_amount}}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-dialog>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- listLoading: false,
- page: 1,
- pageCount: 0,
- //基础数据
- editBasisData: {
- materialTypeList: [],
- },
- //本地存时间,请求时不发送
- time: [],
- search: {
- keyword: '',
- user_id: '',
- title: '',
- user_name: '',
- check_status: '1',
- date_start: null,
- date_end: null,
- },
- list: [],
- //弹框配置
- addForm: {
- id: '',
- name: '',
- },
- title: "",
- dialogFormVisible: false, //数据弹窗
- data_list: {
- source:{"type":1,"source": ['1','2']},
- },//数据
- goods_data:[],//详细数据
- dialogAddgsVisible: false,
- // 对话框显示与否
- dialogVisible: false,
- dataloading: false,
- pagination:null,
- };
- },
- methods: {
- searchs() {
- this.page = 1;
- this.getList();
- },
- pageChange(currentPage) {
- let self = this;
- self.page = currentPage;
- self.getList();
- },
- getList() {
- let self = this;
- self.listLoading = true;
- // 检查是否选择了搜索时间
- if (!self.time) {
- self.search.date_start = '';
- self.search.date_end = '';
- } else {
- self.search.date_start = self.time[0];
- self.search.date_end = self.time[1];
- }
- request({
- method: 'post',
- params: {
- r: 'xhs/default/index',
- },
- data: {
- page: self.page,
- keyword: self.search.keyword,
- user_id: self.search.user_id,
- mobile: self.search.mobile,
- user_name: self.search.user_name,
- check_status: self.search.check_status,
- date_start: self.search.date_start,
- date_end: self.search.date_end,
- title: self.search.title,
- },
- }).then(e => {
- self.listLoading = false;
- self.list = e.data.data.list;
- this.pagination = e.data.data.pagination;
- this.pagination.pageSize = e.data.data.page_size;
- this.pagination.total_count = e.data.data.count;
- }).catch(e => {
- console.log(e);
- });
- },
- detail(data) {
- console.log(data);
- this.data_list = [];
- this.goods_data = [];
- this.dialogFormVisible = true;
- this.data_list = data;
- this.goods_data.push(data);
- },
- handle(type,data = null){
- switch (type) {
- case 'delete':// 删除
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send({id: data.id,status:-1,type:'1'});})
- break;
- case 'enable':
- var status = 0;
- if(data.status=='0') status = 1;
- this.send({id: data.id,status: status,type:'1'});
- break;
- }
- },
- send(data){
- let self = this;
- self.listLoading = true;
- request({
- params: {
- r: 'xhs/default/edit',
- },
- method: 'post',
- data:data,
- }).then(e => {
- self.listLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- } else {
- self.$message.error(e.data.msg);
- }
- self.getList();
- }).catch(e => {
- console.log(e);
- });
- },
- /**
- *关闭或取消模态框,清空值
- * @param
- */
- closeDialogAddgsVisible() {
- this.$refs.addForm.resetFields();//element封装的方法,清空模态框的值
- this.title = "" //初始化title的值
- this.addForm = {//初始化addForm中的值
- title: "",
- }
- },
- },
- mounted: function () {
- this.getList();
- }
- });
- </script>
|