| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364 |
- @extends('layouts.base')
- @section('title', '榜单管理')
- @section('content')
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
- <style>
- </style>
- <div id='re_content'>
- <div class="con">
- <div class="setting">
- <div class="block">
- <el-form label-width="10%">
- <div class="title" style="justify-content: space-between;">
- <div style="display:flex;align-items:center;"><span
- style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>榜单管理</b>
- </div>
- <a href="{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.add-page') !!} ">
- <el-button size="mini" type="primary">添加榜单</el-button>
- </a></div>
- <el-input v-model="search_form.name" style="width:15%;margin-right:16px;"
- placeholder="榜单名称"></el-input>
- <el-select v-model="search_form.rank_type" placeholder="排行周期"
- style="margin-right:16px;width:12%;" clearable>
- <el-option
- v-for="item in options"
- :key="item.id"
- :label="item.label"
- :value="item.id">
- </el-option>
- </el-select>
- <a>
- <el-button type="primary" icon="el-icon-search" @click="search()">搜索</el-button>
- </a>
- <div style="margin: 10px;">
- <a>
- <el-button size="mini" type="primary" @click="statistics(1)">统计天榜单数据</el-button>
- </a>
- <a>
- <el-button size="mini" type="primary" @click="statistics(2)">统计周榜单数据</el-button>
- </a>
- <a>
- <el-button size="mini" type="primary" @click="statistics(3)">统计月榜单数据</el-button>
- </a>
- <a>
- <el-button size="mini" type="primary" @click="statistics(4)">统计季度榜单数据</el-button>
- </a>
- </div>
- </el-form>
- </div>
- <div style="background: #eff3f6;width:100%;height:15px;"></div>
- <div class="block">
- <div class="title">
- <div style="display:flex;align-items:center;"><span
- style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>榜单列表</b>
- </div>
- </div>
- </div>
- <template style="margin-top:-10px;">
- <el-table
- :data="tableData"
- style="padding:0 10px"
- >
- <el-table-column
- prop="id"
- align="center"
- label="榜单ID"
- >
- </el-table-column>
- <el-table-column
- prop="name"
- align="center"
- label="榜单名称"
- >
- </el-table-column>
- <el-table-column
- prop="created_at"
- align="center"
- label="添加时间"
- >
- <template slot-scope="scope">
- [[scope.row.created_at]]
- </template>
- </el-table-column>
- <el-table-column
- prop="show_count"
- align="center"
- label="榜单商品数量"
- >
- </el-table-column>
- <el-table-column
- prop="rank_type"
- align="center"
- label="排行方式"
- >
- <template slot-scope="scope">
- <div v-if="scope.row.rank_type==1">天</div>
- <div v-if="scope.row.rank_type==2">周</div>
- <div v-if="scope.row.rank_type==3">月</div>
- <div v-if="scope.row.rank_type==4">季度</div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button size="mini" style="margin-right: 10px;" @click="openDia(scope.row)">推广
- </el-button>
- <el-button size="mini" style="margin-right: 10px;" @click="goEdit(scope.row)">编辑
- </el-button>
- <el-button size="mini" style="margin-right: 10px;" @click="del(scope, tableData)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-row style="background-color:#fff;">
- <el-col :span="24" align="center" migra style="padding:15px 5% 15px 0" v-loading="loading">
- <el-pagination background @current-change="currentChange"
- :current-page="current_page"
- layout="prev, pager, next"
- :page-size="Number(page_size)" :current-page="current_page"
- :total="page_total"></el-pagination>
- </el-col>
- </el-row>
- </template>
- </div>
- <el-dialog
- center
- title="推广"
- :visible.sync="dialogVisible"
- width="60%">
- <template>
- <el-radio-group v-model="activeName">
- <el-radio-button label="one">推广链接</el-radio-button>
- <el-radio-button label="second">微信小程序</el-radio-button>
- </el-radio-group>
- </template>
- <div v-if="activeName=='one'" style="display:flex;margin-top:20px;">
- {{-- <div><img :src="`${obj.extension_poster}?${Date.now()}`" style="width: 298px;height: 418px;"></div>--}}
- <div class="right" style="margin-left:20px;">
- <div style="margin-bottom:20px;">分享链接</div>
- <div style="display:flex;">
- <el-input type="text" v-model="obj.extension_url" ref="extension_url"></el-input>
- <el-button @click="copy_two" type="primary" size="small">复制链接</el-button>
- </div>
- <div class="tips" style="margin-top:20px;margin-bottom:20px;">
- 可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!
- </div>
- {{-- <div style="display:flex;">--}}
- {{-- <el-button type="primary" size="small" style="margin-right:20px;" @click="download(1)">--}}
- {{-- 下载海报--}}
- {{-- </el-button>--}}
- {{-- <el-button type="primary" size="small" @click="download(2)">下载二维码</el-button>--}}
- {{-- </div>--}}
- </div>
- </div>
- <div v-if="activeName=='second'" style="display:flex;margin-top:20px;">
- {{-- <div><img :src="`${obj.applets_poster}?${Date.now()}`" style="width: 298px;height: 418px;"></div>--}}
- <div class="right" style="margin-left:20px;">
- <div style="margin-bottom:20px;">小程序路径</div>
- <div style="display:flex;">
- <el-input type="text" v-model="obj.applets_url" ref="applets_url"></el-input>
- <el-button @click="copy" type="primary" size="small">复制链接</el-button>
- </div>
- <div class="tips" style="margin-top:20px;margin-bottom:20px;">
- 可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!
- </div>
- {{-- <div style="display:flex;">--}}
- {{-- <el-button type="primary" size="small" style="margin-right:20px;" @click="download(3)">--}}
- {{-- 下载海报--}}
- {{-- </el-button>--}}
- {{-- <el-button type="primary" size="small" @click="download(4)">下载二维码</el-button>--}}
- {{-- </div>--}}
- </div>
- </div>
- </el-dialog>
- </div>
- </div>
- <script>
- var vm = new Vue({
- el: "#re_content",
- delimiters: ['[[', ']]'],
- data() {
- return {
- obj: {},
- activeName: 'one',
- loading: false,
- page_total: 0,
- page_size: 0,
- current_page: 0,
- dialogVisible: false,
- options: [
- {
- id: 1,
- label: '天'
- },
- {
- id: 2,
- label: '周'
- },
- {
- id: 3,
- label: '月'
- },
- {
- id: 4,
- label: '季度'
- },
- ],
- report_id: '',
- times: [],
- search_loading: false,
- all_loading: false,
- info: {},
- search_form: {
- name: '',
- rank_type: ''
- },
- real_search_form: {},
- tableData: []
- }
- },
- mounted() {
- this.search();
- },
- methods: {
- copy_two() {
- that = this;
- let Url = that.$refs['extension_url'];
- Url.select(); // 选择对象
- document.execCommand("Copy", false);
- that.$message({message: "复制成功!", type: "success"});
- },
- copy() {
- that = this;
- let Url = that.$refs['applets_url'];
- Url.select(); // 选择对象
- document.execCommand("Copy", false);
- that.$message({message: "复制成功!", type: "success"});
- },
- {{--download(type) {--}}
- {{-- var url = '{!! yzWebFullUrl('plugin.pack-fixed-price.admin.download.download') !!}' + '&id=' + this.obj.id + '&type=' + type;--}}
- {{-- var a = document.createElement('a');--}}
- {{-- a.target = "_blank";--}}
- {{-- a.href = url;--}}
- {{-- a.click();--}}
- {{--},--}}
- openDia(item) {
- this.activeName = "one"
- this.obj = item;
- this.dialogVisible = true
- },
- del(scope, rows) {
- this.$confirm('是否删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- rows.splice(scope.$index, 1);
- let json = {
- id: scope.row.id
- }
- this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.delete') !!}', json).then(function (response) {
- if (response.data.result) {
- this.$message({message: "删除成功", type: "success"});
- this.loading = false;
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- }, function (response) {
- console.log(response);
- this.loading = false;
- }
- );
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消操作'
- });
- });
- },
- goEdit(item) {
- let link = `{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.add-page') !!}` + `&id=` + item.id;
- window.location.href = link;
- },
- search() {
- this.search_loading = true;
- let json = {
- search: this.search_form,
- }
- this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.get-list') !!}', json
- ).then(function (response) {
- if (response.data.result) {
- let datas = response.data.data;
- this.tableData = datas.data
- this.page_total = datas.total;
- this.page_size = datas.per_page;
- this.current_page = datas.current_page;
- this.loading = false;
- this.real_search_form = Object.assign({}, this.search_form);
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- this.search_loading = false;
- }, function (response) {
- this.search_loading = false;
- this.$message({message: response.data.msg, type: 'error'});
- }
- );
- },
- statistics(val) {
- var url = '';
- if (val == 1) {
- url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.day') !!}';
- } else if (val == 2) {
- url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.week') !!}';
- } else if (val == 3) {
- url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.month') !!}';
- } else if (val == 4) {
- url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.quarter') !!}';
- } else {
- return;
- }
- this.$http.post(url).then(function (response) {
- if (response.data.result) {
- this.$message({message: "成功", type: "success"});
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- }, function (response) {
- this.$message({message: response.data.msg, type: 'error'});
- }
- );
- },
- currentChange(val) {
- this.loading = true;
- this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.get-list') !!}', {
- page: val,
- search: this.real_search_form
- }).then(function (response) {
- if (response.data.result) {
- let datas = response.data.data;
- this.tableData = datas.data
- this.page_total = datas.total;
- this.page_size = datas.per_page;
- this.current_page = datas.current_page;
- this.loading = false;
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- }, function (response) {
- console.log(response);
- this.loading = false;
- }
- );
- },
- },
- });
- </script>
- @endsection
|