| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- @extends('layouts.base')
- @section('title', '分类管理')
- @section('content')
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.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;
- }
- /*.el-select .el-input {*/
- /* width: 120px;*/
- /*}*/
- .input-with-select .el-input-group__prepend {
- background-color: #fff;
- }
- </style>
- <div class="all">
- <div id="app" v-cloak>
- <div class="vue-head">
- <div class="title" v-if="parent_title" style="margin-bottom: 15px"><span
- style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block"></span><b>[[parent_title]]</b>
- </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.title" placeholder="分类名"></el-input>
- </el-form-item>
- <el-form-item>
- <el-select v-model="search_form.is_show" placeholder="显示状态">
- <el-option
- v-for="(item,index) in show_arr"
- :key="index"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item v-if="is_max">
- <el-select v-model="search_form.target_type" placeholder="类型">
- <el-option
- v-for="(item,index) in type_arr"
- :key="index"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-button type="primary" @click="changeForm()">搜索</el-button>
- </el-form>
- </div>
- </div>
- <div class="vue-main">
- <div class="vue-main-form">
- <div class="vue-main-title" style="margin-top:-10px">
- <div class="title">
- <span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>分类列表</b>
- <el-button style="margin-left: 10px" type="primary" @click="addCategory">添加分类</el-button>
- <el-button v-if="search_form.parent_id==0&&reset_state==0" style="margin-left: 10px"
- @click="resetCategory" :loading="resetRemindLoading">
- 基础数据
- </el-button>
- <el-button v-if="search_form.parent_id==0&&reset_state==1" style="margin-left: 10px"
- :disabled="true">
- 基础数据更新中,请勿修改
- </el-button>
- </div>
- </div>
- </div>
- <div style="margin-bottom:20px">
- </div>
- <el-table :data="list" style="width: 100%;" align="center" :fit="true" :row-style="{ height: '80px'}">
- <el-table-column style="min-height:100px;" min-width="15%" prop="id" label="ID"
- align="center"></el-table-column>
- <el-table-column style="min-height:100px;" min-width="15%" prop="sort" label="排序"
- align="center"></el-table-column>
- <el-table-column min-width="15%" prop="title" label="名称" align="center"></el-table-column>
- <el-table-column min-width="15%" label="图标" align="center">
- <template slot-scope="scope">
- <el-link target="_blank" :href="scope.row.cover">
- <el-image :src="scope.row.cover" style="height: 80px;width: 80px"></el-image>
- </el-link>
- </template>
- </el-table-column>
- <el-table-column v-if="!is_max" min-width="15%" prop="child_count" label="类目数量"
- align="center"></el-table-column>
- <el-table-column v-if="is_max" min-width="20%" prop="type_name"
- align="center" label="类型"></el-table-column>
- <el-table-column v-if="is_max" min-width="20%" align="center" label="参数值">
- <template slot-scope="scope">
- <div v-if="scope.row.target_type==-1 || scope.row.target_type==-2 || scope.row.target_type==-3">
- <p>
- <template v-if="scope.row.target_type==-1">淘宝</template>
- <template v-if="scope.row.target_type==-2">京东</template>
- <template v-if="scope.row.target_type==-3">拼多多</template>
- 关键词:[[scope.row.target.keyword]]
- </p>
- </div>
- <div v-if="scope.row.target_type==-4">
- <p>网页标题:[[scope.row.target.web_title]]</p>
- <p></p>
- <p>网页链接:[[scope.row.target.web_url]]</p>
- </div>
- <div v-if="scope.row.target_type==-5">
- <p>APP路径:[[scope.row.target.app_route]]</p>
- </div>
- <div v-if="scope.row.target_type==-6">
- <p>小程序路径:[[scope.row.target.mini_route]]</p>
- </div>
- <div v-if="scope.row.target_type==-7">
- <p>品牌券id:[[scope.row.target.brand_id]]</p>
- </div>
- <div v-if="scope.row.target_type==-8">
- <p>品牌券商品id:[[scope.row.target.brand_goods_id]]</p>
- </div>
- <div v-if="scope.row.target_type==-9">
- <p>
- <template v-if="scope.row.target.another_plat==1">淘宝</template>
- <template v-if="scope.row.target.another_plat==3">京东</template>
- 活动:[[scope.row.target.activity_info]]
- </p>
- </div>
- <div v-if="scope.row.target_type==-10">
- <p>
- <template v-if="scope.row.target.list_type==1">淘宝特色物料 -
- [[scope.row.target.list_id]]]
- </template>
- <template v-if="scope.row.target.list_type==2">京东特色列表 - [[
- jd_special_url_type[scope.row.target.list_id] ]]
- </template>
- <template v-if="scope.row.target.list_type==3">拼多多特色列表 - [[
- pdd_special_url_type[scope.row.target.list_id] ]]
- </template>
- <template v-if="scope.row.target.list_type==4">拼多多爆款排行</template>
- </p>
- </div>
- <div v-if="scope.row.target_type==-11">
- <p>
- <template v-if="scope.row.target.album_type==1">专辑列表</template>
- <template v-if="scope.row.target.album_type==2">专辑详情:[[scope.row.target.album_id]]
- </template>
- </p>
- </div>
- <div v-if="scope.row.target_type==-12">
- <p>
- APP路径 - [[scope.row.target.app_path]]
- APP参数:[[scope.row.target.pathParam]]
- </p>
- </div>
- </template>
- </el-table-column>
- <el-table-column min-width="15%" label="显示状态" align="center">
- <template slot-scope="scope">
- <el-switch
- :active-value="1"
- :inactive-value="0"
- v-model="scope.row.is_show"
- active-color="#13ce66"
- inactive-color="#545454"
- @change="changeShowState(scope.row)"
- >
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column min-width="20%" label="操作" align="center">
- <template slot-scope="scope">
- <el-button v-if="!is_max" @click="childList(scope.row)" type="primary"
- icon="el-icon-s-promotion"
- circle></el-button>
- <el-button type="" @click="editCategory(scope.row)" icon="el-icon-edit-outline"
- circle></el-button>
- <el-button @click="deleteCategory(scope.row)" type="danger"
- icon="el-icon-delete-solid" circle></el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="vue-page" v-if="total > 0">
- <el-row>
- <el-col align="right">
- <el-pagination layout="prev, pager, next,jumper" @current-change="getData" :total="total"
- :page-size="per_page" :current-page="current_page" background
- ></el-pagination>
- </el-col>
- </el-row>
- </div>
- </div>
- <!-- 分页 -->
- </div>
- </div>
- <script>
- var app = new Vue({
- el: "#app",
- delimiters: ['[[', ']]'],
- name: 'test',
- data() {
- let level = 1;
- let parent_id = 0;
- if (this.checkEmpty("{!! $_GET['level'] !!}")) {
- level = "{!! $_GET['level'] !!}";
- }
- if (this.checkEmpty("{!! $_GET['parent_id'] !!}")) {
- parent_id = "{!! $_GET['parent_id'] !!}";
- }
- return {
- list: [],
- total: 1,
- per_page: 1,
- current_page: 1,
- reset_state: 0,
- resetRemindLoading: false,
- max_level: '3',
- is_max: 0,
- parent_title: '',
- search_form: {
- 'title': '',
- 'parent_title': '',
- 'id': '',
- 'parent_id': parent_id,
- 'level': level,
- 'is_show': '-1',
- 'target_type': '-999'
- },
- show_arr: [
- {value: '-1', label: '显示状态'},
- {value: '0', label: '不显示'},
- {value: '1', label: '显示'}
- ],
- type_arr: [
- {value: '-999', label: '类型'},
- {value: '-1', label: '淘宝'},
- {value: '-2', label: '京东'},
- {value: '-3', label: '拼多多'},
- {value: '-4', label: '网页'},
- {value: '-5', label: '自定义'},
- {value: '-6', label: '小程序'},
- {value: '-7', label: '品牌券'},
- {value: '-8', label: '品牌券商品'},
- {value: '-9', label: '京东/淘宝官方活动'},
- {value: '-10', label: '特色商品资源'},
- {value: '-11', label: '专辑'},
- ],
- search_data: {},
- taobao_special_url_type: {!! $taobao_special_url_type !!},
- jd_special_url_type:{!! $jd_special_url_type !!},
- pdd_special_url_type:{!! $pdd_special_url_type !!},
- }
- },
- created() {
- },
- mounted() {
- this.changeForm();
- },
- methods: {
- resetCategory: function () {
- this.$confirm('确定要追加预设分类数据吗?', '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- // dangerouslyUseHTMLString:true
- }).then(() => {
- this.resetRemindLoading = true;
- // this.$message({message: '开始追加数据,过程可能需要20-30分钟,请耐心等候,过程中请勿修改分类数据', type: 'success'});
- this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.resetCategory') !!}', {}
- ).then(function (response) {
- console.log(response);
- if (response.data.result) {
- this.$message({message: response.data.msg, type: 'success'});
- this.search();
- this.resetRemindLoading = false;
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- this.search();
- this.resetRemindLoading = false;
- }
- }, function (response) {
- this.$message({message: response.data.msg, type: 'error'});
- this.search();
- });
- }).catch(() => {
- this.$message({message: '已取消操作'});
- });
- },
- deleteCategory: function (data) {
- var mes = '确定删除分类吗?';
- if (data.has_many_child_category.length != 0) {
- mes = '该分类存在下级分类,' + mes;
- }
- this.$confirm(mes, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- // dangerouslyUseHTMLString:true
- }).then(() => {
- this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.deleteCategory') !!}', {
- 'id': data.id,
- }).then(function (response) {
- console.log(response);
- if (response.data.result) {
- this.$message({message: response.data.msg, type: 'success'});
- this.search();
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- this.search();
- }
- }, function (response) {
- this.$message({message: response.data.msg, type: 'error'});
- this.search();
- });
- }).catch(() => {
- this.$message({message: '已取消操作'});
- });
- },
- editCategory: function (data) {
- var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.edit') !!}" + '&id=' + data.id;
- window.location.href = url;
- // window.open(url);
- },
- addCategory: function () {
- var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.edit') !!}" + '&parent_id=' + this.search_data.parent_id;
- window.location.href = url;
- // window.open(url);
- },
- childList: function (data) {
- var level = data.level + 1;
- var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.index') !!}" + '&level=' + level + '&parent_id=' + data.id;
- window.open(url);
- },
- checkEmpty: function (val) {
- if (val != 'undefined' && val != null && val != '0' && val != 0 && val != '') {
- return true;
- }
- return false;
- },
- copyUrl: function (url, msg) {
- let oInput = document.createElement('input');
- oInput.value = url;
- document.body.appendChild(oInput);
- oInput.select(); // 选择对象;
- console.log(oInput.value);
- document.execCommand("Copy"); // 执行浏览器复制命令
- this.$message({message: msg, type: 'success'});
- oInput.remove()
- },
- openUrl: function (url) {
- window.open(url);
- },
- showAppModal: function () {
- this.app_list = [];
- this.app_show = true;
- this.app_modal_text1 = true;
- this.app_modal_text2 = false;
- this.showUploaderEl = true;
- },
- changeShowState: function (data) {
- var is_show = data.is_show;
- this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.changeShowState') !!}', {
- 'id': data.id, 'is_show': is_show
- }).then(function (response) {
- console.log(response);
- if (response.data.result) {
- this.$message({message: response.data.msg, type: 'success'});
- this.search();
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- this.search();
- }
- }, function (response) {
- this.$message({message: response.data.msg, type: 'error'});
- this.search();
- });
- },
- search: function () {
- this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.index') !!}', {
- 'page': this.current_page,
- 'is_json': 1,
- 'search_data': this.search_data,
- }).then(function (response) {
- console.log(response);
- if (response.data.result) {
- let this_data = response.data.data.list;
- let setting = response.data.data.setting;
- this.parent_title = setting.parent_title;
- // this.parent_name = setting.parent_name;
- this.is_max = setting.is_max;
- this.max_level = setting.max_level;
- this.reset_state = setting.reset_state;
- this.current_page = this_data.current_page;
- this.list = this_data.data;
- this.total = this_data.total;
- this.per_page = this_data.per_page;
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- }, function (response) {
- this.$message({message: response.data.msg, type: 'error'});
- })
- },
- getData: function (val) {
- this.current_page = val;
- this.search();
- },
- changeForm: function () {
- this.search_data = this.search_form;
- this.current_page = 1;
- this.search();
- }
- },
- })
- </script>
- @endsection
|