| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- @extends('layouts.base')
- @section('title', "盲盒管理")
- @section('content')
- <link rel="stylesheet" href="{{resource_get('plugins/blind-box/views/admin/index.css')}}">
- <style>
- .edit-i{display:none;}
- .el-table_1_column_2:hover .edit-i{font-weight:900;padding:0;margin:0;display:inline-block;}
- .el-tabs__item,.is-top{font-size:16px}
- .el-tabs__active-bar { height: 3px;}
- </style>
- <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.id" placeholder="活动ID"></el-input>
- </el-form-item>
- <el-form-item label="">
- <el-input v-model="search_form.name" placeholder="活动名称"></el-input>
- </el-form-item>
- <el-form-item label="">
- <el-select v-model="search_form.activity_type" clearable placeholder="盲盒类型">
- <el-option label="付费" value="0"></el-option>
- <el-option label="免费" value="1"></el-option>
- </el-select>
- </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 class="vue-main-form">
- <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 120px">盲盒列表</div>
- <div class="vue-main-title-button">
- <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新增盲盒</el-button>
- </div>
- </div>
- <el-table :data="list" style="width: 100%">
- <el-table-column label="ID" align="center" prop="id"></el-table-column>
- <el-table-column label="活动名称" align="center" prop="activity_name"> </el-table-column>
- <el-table-column label="盲盒类型" align="center" prop="category">
- <template slot-scope="scope">
- <div >[[scope.row.activity_type?'免费':'付费']]</div>
- </template>
- </el-table-column>
- <el-table-column label="盲盒库存" align="center" prop="stock">
- <template slot-scope="scope">
- <div>
- <div>[[scope.row.goods.stock]]</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="已发放盲盒数量" align="center" prop="sales">
- <template slot-scope="scope">
- <div>
- <div>[[scope.row.goods.show_sales]]</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="活动时间" align="center" prop="created_at" width="110">
- <template slot-scope="scope">
- <div>
- <div>[[scope.row.activity_start]]至[[scope.row.activity_end]]</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center" prop="is_open">
- <template slot="header" slot-scope="scope">
- <div>状态</div>
- </template>
- <template slot-scope="scope">
- <el-switch v-model="scope.row.is_open" :active-value="1" :inactive-value="0" @change="editStatus(scope.row.id,scope.$index)"></el-switch><br />
- </template>
- </el-table-column>
-
- <el-table-column prop="refund_time" label="操作" align="center" width="250">
- <template slot-scope="scope">
- <el-link title="推广" :underline="false" @click="openShare(scope.row.id)" style="width:50px;">
- 推广
- </el-link>
- <el-link title="数据" :underline="false" @click="openOrder(scope.row.id)" style="width:50px;">
- 数据
- </el-link>
- <el-link title="编辑" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
- <i class="iconfont icon-ht_operation_edit"></i>
- </el-link>
- <el-link title="删除" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
- <i class="iconfont icon-ht_operation_delete"></i>
- </el-link>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <el-dialog title="推广" :visible.sync="share_show" width="800">
- <div style="display:flex">
- <div class="left" style="flex:2;text-align:left">
- <el-button type="text" @click="changeShare(1)" :style="{color:(share_index==1?'':'#333')}" style="font-size:18px">推广链接和二维码</el-button><br />
- <el-button type="text" @click="changeShare(2)" :style="{color:(share_index==2?'':'#333')}" style="font-size:18px" v-if="share_data.mini_show">微信小程序</el-button>
- </div>
- <div class="center" style="width:355px;height:550px;margin:0 20px" >
- <img :src="show_share_data.poster" alt="" style="width:100%;">
- </div>
- <div class="right" style="flex:3">
- <div>分享链接</div>
- <el-input v-model="show_share_data.url" style="width:70%" ref="url"></el-input>
- <el-button @click="copyLink('url')">复制</el-button>
- <div class="tip" style="margin:20px 0">可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!</div>
- <div>
- <el-button type="text" @click="download(show_share_data.poster,'poster')">下载海报</el-button>
- <el-button type="text" @click="download(show_share_data.qr_code,'qr_code')">下载二维码</el-button>
- </div>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <!-- <el-button @click="share_show = false">取 消</el-button> -->
- <!-- <el-button type="primary" @click="img_text_url = false">确 定</el-button> -->
- </span>
- </el-dialog>
- <!-- 分页 -->
- <div class="vue-page" >
- <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 {
- activeName:'2',
- street:0,
- list:[],
- change_sort:'',
- times:[],
- share_data : {
- mini:{},
- h5:{},
- mini_show:0
- },
- show_share_data : {
- url:"",
- qr_code:"",
- poster:""
- },
- search_form:{
- name:"",
- id:"",
- activity_type:"",
- },
- // 统计
- count:{
- success: 0,
- total: 0,
- },
- share_show:false,
- share_index:1,
- rules: {},
- current_page:1,
- total:1,
- per_page:1,
- }
- },
- created() {
- },
- mounted() {
- this.getData(1);
- },
- methods: {
- getData(page) {
- // console.log(this.times)
- let json = {
- page: page,
- search: {
- activity_type:this.search_form.activity_type,
- id:this.search_form.id,
- name:this.search_form.name,
- },
- };
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.activity-list') !!}',json).then(function(response) {
- if (response.data.result) {
- // console.log(response.data.data)
- this.list = response.data.data.data;
- this.current_page=response.data.data.current_page;
- this.total=response.data.data.total;
- this.per_page=response.data.data.per_page;
- this.count.total=response.data.data.total;
- 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();
- });
- },
- editStatus(id,index){
- let json = {
- id:id,
- }
- json.status = this.list[index].is_open;
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.edit-activity-status') !!}',json).then(function (response) {
- if (response.data.result){
- this.$message.success("操作成功");
- this.search(this.current_page);
- }
- else {
- this.$message.error( response.data.msg );
- }
- loading.close();
- },function (response) {
- this.$message.error(response.data.msg);
- loading.close();
- }
- );
- },
- gotoDetail(item) {
- let link = `{!! yzWebFullUrl('plugin.blind-box.admin.activity.edit') !!}`+`&id=`+item.id;
- window.location.href = link;
- },
- addModal() {
- let link = `{!! yzWebFullUrl('plugin.blind-box.admin.activity.add') !!}`;
- // console.log(link);
- window.location.href = link;
- },
- openShare(id) {
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.extension') !!}',{id:id}).then(function (response) {
- if (response.data.result){
- this.share_index = 1;
- this.share_data.h5 = response.data.data.h5;
- this.share_data.mini = response.data.data.mini;
- this.share_data.mini_show = response.data.data.mini_show;
- this.show_share_data = this.share_data.h5;
- this.share_show = true;
- }
- else {
- this.$message.error( response.data.msg );
- }
- loading.close();
- },function (response) {
- this.$message.error(response.data.msg);
- this.share_show = false;
- loading.close();
- }
- );
- },
- openOrder(id){
- window.location = '{!! yzWebFullUrl('plugin.blind-box.admin.order-list.index') !!}&activity_id='+id;
- },
- changeShare(index) {
- this.share_index = index;
- if(index == 1){
- this.show_share_data = this.share_data.h5;
- }else if(index == 2 && this.share_data.mini_show) {
- this.show_share_data = this.share_data.mini;
- }
- },
-
- search(val) {
- this.getData(val);
- },
-
- del(id) {
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.del') !!}',{id:id}).then(function (response) {
- if (response.data.result){
- this.$message.success("操作成功");
- this.search(this.current_page);
- }
- else {
- this.$message.error( response.data.msg );
- }
- loading.close();
- },function (response) {
- this.$message.error(response.data.msg);
- loading.close();
- }
- );
- },
- copyLink(type) {
- this.$refs[type].select();
- document.execCommand("Copy")
- this.$message.success("复制成功!");
- },
- download(href, name) {
- let eleLink = document.createElement("a");
- eleLink.download = name;
- eleLink.href = href;
- eleLink.click();
- eleLink.remove();
- },
- },
- })
- </script>
- @endsection
|