bztang-admin/plugins/new-poster/views/admin/record.blade.php

280 lines
12 KiB
PHP

@extends('layouts.base')
@section('title', "海报生成记录")
@section('content')
<link rel="stylesheet" href="{{resource_get('plugins/new-poster/views/admin/index.css')}}">
<div class="all">
<div id="app" v-cloak>
<div class="vue-crumbs">
海报 > 生成记录
</div>
<div class="vue-head">
<div class="vue-main-title" style="margin-bottom:20px">
<div class="vue-main-title-left"></div>
<div class="vue-main-title-content">生成记录</div>
<div class="vue-main-title-button">
</div>
</div>
<div class="vue-search">
<el-form :inline="true" :model="search_form" class="demo-form-inline">
<el-form-item label="">
<el-input v-model="search_form.member_id" placeholder="会员ID"></el-input>
</el-form-item>
<el-form-item label="">
<el-input v-model="search_form.member" placeholder="会员昵称/姓名/手机号"></el-input>
</el-form-item>
<el-form-item label="时间范围">
<el-date-picker
v-model="times"
type="datetimerange"
value-format="timestamp"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
style="margin-left:5px;"
align="right">
</el-date-picker>
</el-form-item>
<el-form-item label="">
<el-button type="primary" @click="search(1)">搜索</el-button>
</el-form-item>
</el-form>
</div>
</div>
<div class="vue-main">
<div>
<div class="vue-main-title" style="margin-bottom:20px">
<div class="vue-main-title-left"></div>
<div class="vue-main-title-content" style="flex:0 0 100px">生成列表</div>
<div class="" style="text-align:left;font-size:12px;color:#999">
<span>总数:[[total]]</span>&nbsp;&nbsp;&nbsp;
</div>
<div class="vue-main-title-button">
<el-button type="danger" size="small" @click="allDel">一键删除</el-button>
</div>
</div>
<el-table :data="list" style="width: 100%">
<!-- <el-table-column label="ID" align="center" prop="id" width="70"></el-table-column> -->
<el-table-column label="生成时间" align="center" prop="created_at"></el-table-column>
<el-table-column label="海报路径" align="center" prop="url"></el-table-column>
<el-table-column label="会员ID" align="center" prop="member_id"></el-table-column>
<el-table-column align="center" prop="created_at">
<template slot="header" slot-scope="scope">
<div>会员信息</div>
</template>
<template slot-scope="scope">
<div v-if="scope.row.mc_member">
<div>
<img :src="scope.row.mc_member.avatar_image" alt="" style="width:40px;height:40px;border-radius:50%">
</div>
<div class="vue-ellipsis">[[scope.row.mc_member.nickname]]</div>
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="操作">
<template slot-scope="scope">
<a :href="scope.row.url" download>
<el-button size="mini" plain type="primary">下载</el-button>
</a>
<el-button size="mini"plain type="success" @click="reNew(scope.row)">重新生成</el-button>
<el-button size="mini" plain type="danger" @click="del(scope.row.id,scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 分页 -->
<div class="vue-page" v-if="total>0">
<el-row>
<el-col align="right">
<el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
:page-size="per_page" :current-page="current_page" background
></el-pagination>
</el-col>
</el-row>
</div>
</div>
</div>
<script>
var app = new Vue({
el: "#app",
delimiters: ['[[', ']]'],
name: 'test',
data() {
return {
id:0,
search_form:{},
times:[],
list:[],
count:{},
rules: {},
current_page:1,
total:1,
per_page:1,
}
},
created() {
},
mounted() {
this.id = this.getParam('id')
this.getData(1);
},
methods: {
getData(page) {
let json = {
page:page,
id:this.id,
search_form:{
member:this.search_form.member,
member_id:this.search_form.member_id,
// search_time:[],
}
}
if(this.times&&this.times!=null&&this.times.length>0) {
console.log(this.times)
json.search_form.search_time = [];
json.search_form.search_time[0] = this.times[0]/1000;
json.search_form.search_time[1] = this.times[1]/1000;
}
let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster-record.getList') !!}',json).then(function(response) {
if (response.data.result) {
this.list = response.data.data.list.data;
this.current_page=response.data.data.list.current_page;
this.total=response.data.data.list.total;
this.per_page=response.data.data.list.per_page;
loading.close();
} else {
this.$message({
message: response.data.msg,
type: 'error'
});
}
loading.close();
}, function(response) {
this.$message({
message: response.data.msg,
type: 'error'
});
loading.close();
});
},
gotoDetail(item) {
let link = `{!! yzWebFullUrl('plugin.answer-reward.admin.subject.get-view') !!}`+`&id=`+item.id;
window.location.href = link;
},
search(val) {
this.getData(val);
},
addModal() {
let link = `{!! yzWebFullUrl('plugin.answer-reward.admin.subject.get-view') !!}`;
console.log(link);
window.location.href = link;
},
del(id,index) {
console.log(id,index)
this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster-record.delete') !!}',{id:id}).then(function (response) {
if (response.data.result) {
this.list.splice(index,1);
this.$message({type: 'success',message: '删除成功!'});
}
else{
this.$message({type: 'error',message: response.data.msg});
}
loading.close();
this.search(this.current_page)
},function (response) {
this.$message({type: 'error',message: response.data.msg});
loading.close();
}
);
}).catch(() => {
this.$message({type: 'info',message: '已取消删除'});
});
},
allDel() {
this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster-record.allDelete') !!}',{id:this.id}).then(function (response) {
if (response.data.result) {
this.$message({type: 'success',message: '删除成功!'});
}
else{
this.$message({type: 'error',message: response.data.msg});
}
loading.close();
this.search(this.current_page)
},function (response) {
this.$message({type: 'error',message: response.data.msg});
loading.close();
}
);
}).catch(() => {
this.$message({type: 'info',message: '已取消删除'});
});
},
uploadSuccess(res, file) {
if (res.result == 1) {
// this.form.file = res.data.thumb;
this.$message.success(res.msg);
} else {
this.$message.error(res.msg);
}
window.location.reload();
// this.submit_loading = false;
},
beforeUpload(file) {
// this.submit_loading = true;
},
reNew(row) {
let json = {
poster_type:row.poster_type,
id:row.id,
member_id:row.member_id,
}
let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster-record.remake') !!}',json).then(function(response) {
if (response.data.result) {
this.$message({type: 'success',message: '生成成功!'});
}
else{
this.$message({type: 'error',message: response.data.msg});
}
loading.close();
this.search(this.current_page)
}, function(response) {
this.$message({
message: response.data.msg,
type: 'error'
});
loading.close();
});
},
add0(m) {
return m<10?'0'+m:m
},
getParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
},
},
})
</script>
@endsection