| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- @extends('layouts.base')
- @section('content')
- @section('title', trans('素材管理'))
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
- <style>
- .vue-main .el-form-item .el-form-item__label{
- padding: 0 20px 0 0 !important;
- }
- </style>
- <div id="app">
- <div class="all">
- <div class="vue-head">
- <div class="vue-main-title">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content">条件筛选</div>
- <div class="vue-main-title-right"><el-button style="margin-top:10px;color: #29ba9c;" @click="addTemp"> <i class="el-icon-plus"></i> 添加素材</el-button></div>
- </div>
- <div class="vue-search">
- <el-form :inline="true" :model="search" class="demo-form-inline">
- <el-form-item label="">
- <el-input v-model="search.keyword" placeholder="标题"></el-input>
- </el-form-item>
- <el-form-item label="">
- <el-select v-model="search.is_show" placeholder="请选择显示状态" clearable>
- <el-option :key="1" label="显示" :value="1"></el-option>
- <el-option :key="2" label="不显示" :value="2"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="">
- <el-date-picker v-model="search.is_time" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="timestamp">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="">
- <el-button type="primary" @click="handleSearch">搜索</el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <div class="vue-head">
- <div class="vue-main-title">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content">素材列表</div>
- </div>
- <el-table :data="tableData" style="width: 100%">
- <el-table-column prop="id" label="ID" align="center">
- </el-table-column>
- <el-table-column prop="created_at" label="创建时间" align="center">
- </el-table-column>
- <el-table-column prop="title" label="标题" align="center">
- </el-table-column>
- <el-table-column prop="goods.title" label="商品名称" align="center">
- </el-table-column>
- <el-table-column prop="share" label="图片分享数" align="center">
- </el-table-column>
- <el-table-column label="显示状态" align="center">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.is_show" active-color="#29BA9C" inactive-color="#ff4949" :active-value=1 :inactive-value=0 @change="(value) => statusChange(value,scope.row.id)">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <i class="el-icon-edit-outline" style="font-size:18px;cursor:pointer" @click="edit(scope.row.id)"></i>
- <i class="el-icon-delete-solid" style="font-size:18px;cursor:pointer" @click="deleteMaterial(scope.row.id)"></i>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="vue-page">
- <el-row>
- <el-col align="right">
- <el-pagination layout="prev, pager, next,jumper" @current-change="search1" :total="total" :page-size="per_page" :current-page="current_page" background></el-pagination>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <script language='javascript'>
- //vue
- var app = new Vue({
- el: "#app",
- delimiters: ['[[', ']]'],
- data() {
- return {
- options: [{
- label: '显示',
- value: 1
- },
- {
- label: '不显示',
- value: 0
- }
- ],
- page: 1,
- tableData: [],
- current_page: 1,
- total: 1,
- per_page: 15,
- search: {
- keyword: '',
- is_time: [],
- is_show: ''
- }
- }
- },
- computed: {
- },
- mounted() {
- this.getTempList()
- },
- methods: {
- //获取模板列表数据
- getTempList() {
- this.$http.post("{!! yzWebFullUrl('plugin.material-center.admin.material.index') !!}", {
-
- }).then(res => {
- if (res.data.result) {
- this.tableData = res.data.data.list.data
- this.current_page = res.data.data.list.current_page
- this.total = res.data.data.list.total
- this.per_page = res.data.data.list.per_page
- } else {
- this.$message.error(res.data.msg);
- }
- })
- },
- //编辑模板
- edit(id) {
- let url = "{!! yzWebUrl('plugin.material-center.admin.material.add') !!}&id=" + id
- window.location.href = url
- },
- addTemp() {
- let url = "{!! yzWebUrl('plugin.material-center.admin.material.add') !!}"
- window.location.href = url
- },
- deleteMaterial(id) {
- this.$confirm('确定删除嘛', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http.post("{!! yzWebFullUrl('plugin.material-center.admin.material.delete') !!}&id=" + id, {
- id
- }).then(res => {
- if (res.data.result) {
- this.$message.success(res.data.msg);
- this.getTempList()
- } else {
- this.$message.error(res.data.msg);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- // 搜索
- search1(page) {
- this.current_page = page
- this.getTempList(page)
- },
- handleSearch() {
- this.$http.post("{!! yzWebFullUrl('plugin.material-center.admin.material.index') !!}", {
- search:{...this.search}
- }).then(res => {
- this.tableData = res.data.data.list.data
- this.current_page = res.data.data.list.current_page
- this.total = res.data.data.list.total
- this.per_page = res.data.data.list.per_page
- if (res.data.result) {
- } else {
- this.$message.error(res.data.msg);
- }
- })
- },
- statusChange(status,id){
- this.$http.post('{!! yzWebFullUrl("plugin.material-center.admin.material.changeStatus") !!}', {
- is_show:status,
- id:id
- }).then(({
- data
- }) => {
- if (data.result) {
- this.$message.success(data.msg)
- } else {
- this.$message.error(data.msg);
- }
- }, (response) => {
- console.log(response);
- });
- }
- },
- })
- </script>
- @endsection
|