| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- @extends('layouts.base')
- @section('title', '排行榜分类详情')
- @section('content')
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
- <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
- <style>
- .dialog-cover {
- z-index: 2001
- }
- .dialog-content {
- z-index: 2002
- }
- .link1 .el-input__inner {
- padding: 0
- }
- </style>
- <div class="all">
- <div id="app" v-cloak>
- <div class="vue-crumbs">
- <a @click="goParent">排行榜分类</a> > 排行榜分类详情
- </div>
- <div class="vue-main">
- <div class="vue-main-title">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content">排行榜分类详情</div>
- </div>
- <div class="vue-main-form">
- <el-form ref="form" :model="form" :rules="rules" label-width="15%">
- <el-form-item label="排序" prop="display_order">
- <el-input v-model="form.display_order" style="width:70%;" placeholder="请输入排序"></el-input>
- </el-form-item>
- <el-form-item label="分类名称" prop="name">
- <el-input v-model="form.name" style="width:70%;" placeholder="请输入分类名称"></el-input>
- </el-form-item>
- <el-form-item label="是否显示" prop="enabled">
- <el-switch v-model="form.enabled" :active-value="1" :inactive-value="0"></el-switch>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <!-- 分页 -->
- <div class="vue-page">
- <div class="vue-center">
- <el-button type="primary" @click="submitForm('form')">提交</el-button>
- <el-button @click="goBack">返回</el-button>
- </div>
- </div>
- </div>
- </div>
- <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
- @include('public.admin.pop')
- @include('public.admin.program')
- <script>
- let id = {!! $id?:0 !!}
- let
- level = {!! $level?:0 !!}
- let
- parent_id = {!! $parent_id?:0 !!}
- console.log(level)
- console.log(parent_id)
- var app = new Vue({
- el: "#app",
- delimiters: ['[[', ']]'],
- name: 'test',
- data() {
- return {
- id: id,
- form: {
- display_order: '0',
- name: '',
- enabled: 0,
- },
- loading: false,
- rules: {
- name: {required: true, message: '请输入分类名称'}
- },
- type: '',
- selNum: '',
- }
- },
- created() {
- if (this.id) {
- this.submit_url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.category.edit') !!}'
- } else {
- this.submit_url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.category.add') !!}'
- }
- this.getData();
- },
- mounted() {
- },
- methods: {
- clearImg(str, type, index) {
- if (!type) {
- this.form[str] = "";
- this.form[str + '_url'] = "";
- } else {
- this.form[str].splice(index, 1);
- this.form[str + '_url'].splice(index, 1);
- }
- this.$forceUpdate();
- },
- //弹窗显示与隐藏的控制
- changeLink(item) {
- this.show = item;
- },
- //当前链接的增加
- parHref(child, confirm) {
- this.show = confirm;
- // this.form.link=child;
- this.form[this.chooseLink] = child;
- },
- changeprogram(item) {
- this.pro = item;
- },
- parpro(child, confirm) {
- this.pro = confirm;
- // this.form.prolink=child;
- this.form[this.chooseMiniLink] = child;
- },
- showLink(type, name) {
- if (type == "link") {
- this.chooseLink = name;
- this.show = true;
- } else {
- this.chooseMiniLink = name;
- this.pro = true;
- }
- },
- getData() {
- let json = {};
- if (this.id) {
- json.id = this.id
- } else {
- json = {
- level: this.level,
- parent_id: this.parent_id
- }
- }
- console.log(json)
- let loading = this.$loading({
- target: document.querySelector(".content"),
- background: 'rgba(0, 0, 0, 0)'
- });
- this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.category.detail') !!}', json).then(function (response) {
- if (response.data.result) {
- if (this.id) {
- let datas = response.data.data;
- this.form.display_order = datas.display_order;
- this.form.name = datas.name;
- this.form.enabled = datas.enabled || 0;
- this.link = response.data.data.link || "";
- }
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- loading.close();
- }, function (response) {
- this.$message({message: response.data.msg, type: 'error'});
- loading.close();
- }
- );
- },
- searchFilter() {
- let that = this;
- let loading = this.$loading({
- target: document.querySelector(".content"),
- background: 'rgba(0, 0, 0, 0)'
- });
- this.$http.post('{!! yzWebFullUrl('filtering.filtering.get-search-label-v2') !!}', {keyword: this.keyword}).then(response => {
- if (response.data.result) {
- this.filter_list = response.data.data;
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- loading.close();
- }, response => {
- loading.close();
- });
- },
- sureFilter(item) {
- let is_exist = 0;
- this.form.filter_ids.some((item1, index) => {
- if (item1 == item.id) {
- is_exist = 1;
- this.$message.error("请勿重复选择");
- return true;
- }
- })
- if (is_exist == 1) {
- return;
- }
- this.form.filter_ids.push(item.id)
- this.filter_names.push(item.name)
- },
- closeFilter(index) {
- this.form.filter_ids.splice(index, 1);
- this.filter_names.splice(index, 1);
- },
- submitForm(formName) {
- let that = this;
- let json = {
- data: {
- display_order: this.form.display_order,
- name: this.form.name,
- enabled: this.form.enabled,
- }
- };
- if (this.id) {
- json.data.id = this.id;
- }
- this.$refs[formName].validate((valid) => {
- if (valid) {
- let loading = this.$loading({
- target: document.querySelector(".content"),
- background: 'rgba(0, 0, 0, 0)'
- });
- this.$http.post(this.submit_url, json).then(response => {
- if (response.data.result) {
- this.$message({type: 'success', message: '操作成功!'});
- this.goBack();
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- loading.close();
- }, response => {
- loading.close();
- });
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- goBack() {
- history.go(-1)
- },
- goParent() {
- window.location.href = `{!! yzWebFullUrl('plugin.goods-ranking.admin.category.index') !!}`;
- },
- openUpload(str, type, sel) {
- console.log(str, type, 'uuuuuuuuuuu');
- this.chooseImgName = str;
- this.uploadShow = true;
- this.type = type
- this.selNum = sel
- },
- changeProp(val) {
- if (val == true) {
- this.uploadShow = false;
- } else {
- this.uploadShow = true;
- }
- },
- // 参数:fileList 上传文件的列表信息
- sureImg(name, uploadShow, fileList) {
- if (fileList.length <= 0) {
- return
- }
- console.log(name)
- console.log(fileList)
- this.form[name] = fileList[0].attachment;
- this.form[name + '_url'] = fileList[0].url;
- console.log(this.form[name], 'aaaaa')
- console.log(this.form[name + '_url'], 'bbbbb')
- },
- clearImg(str) {
- this.form[str] = "";
- this.form[str + '_url'] = "";
- this.$forceUpdate();
- },
- copyLink(type) {
- this.$refs[type].select();
- document.execCommand("Copy")
- this.$message.success("复制成功!");
- },
- // 字符转义
- escapeHTML(a) {
- a = "" + a;
- return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "'");
- ;
- },
- },
- })
- </script>
- @endsection
|