Przeglądaj źródła

分享路径和折扣规则

natasha 1 rok temu
rodzic
commit
d8bf5c768b

+ 12 - 0
src/components/AudioLine.vue

@@ -138,6 +138,18 @@ export default {
         if (val) this.$emit("handleChangeStopAudio");
       },
     },
+    mp3:{
+      handler(val, oldVal) {
+        const _this = this;
+        if (val) {
+          _this.$refs[_this.audioId].pause();
+          _this.audio.playing = false;
+          _this.audio.currentTime = 0
+        }
+      },
+      // 深度观察监听
+      deep: true,
+    },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 8 - 0
src/components/NavMenu.vue

@@ -161,6 +161,14 @@ export default {
                     {
                         title:'导入配置',
                         index:'export_setting',
+                    },
+                    {
+                        title:'折扣规则',
+                        index:'discount_setting',
+                    },
+                    {
+                        title:'分享路径',
+                        index:'share_setting',
                     }
                 ]
             }

+ 10 - 0
src/router/index.js

@@ -125,6 +125,16 @@ export const constantRoutes = [{
             import ('@/views/system_config/ExportSetting.vue')
     },
     {
+        path: '/discount_setting',
+        component: () =>
+            import ('@/views/system_config/DiscountRuleSetting.vue')
+    },
+    {
+        path: '/share_setting',
+        component: () =>
+            import ('@/views/system_config/ShareSetting.vue')
+    },
+    {
         path: '/personal',
         component: () =>
             import ('@/views/personal.vue')

+ 241 - 0
src/views/system_config/DiscountRuleSetting.vue

@@ -0,0 +1,241 @@
+<template>
+  <div class="manage-root discount-rules">
+    <Header />
+    <div class="manage-root-contain">
+        <nav-menu class="manage-root-contain-left" :activeMenuIndex="activeMenuIndex"></nav-menu>
+        <div class="manage-root-contain-right">
+            <breadcrumb :breadcrumbList="breadcrumbList" class="breadcrumb-box"></breadcrumb>
+            <div class="create-bottom">
+                <h3>折扣规则</h3>
+                <ul>
+                    <li v-for="(item,index) in rule_list" :key="index">
+                        <el-input
+                            class="rule-item"
+                            placeholder=""
+                            v-model="item.buy_count"
+                            @input="handleInput(item,'buy_count')">
+                            <template slot="append">期</template>
+                        </el-input>
+                        <el-input
+                            class="rule-item"
+                            placeholder=""
+                            v-model="item.discount"
+                            @input="handleInputLittle(item,'discount')"
+                            @blur="handleInputLittleBlur(item,'discount')">
+                            <template slot="append">折</template>
+                        </el-input>
+                        <i class="el-icon-delete" @click="handleDelete(index)"></i>
+                    </li>
+                    <a @click="handleAdd">增加折扣</a>
+                </ul>
+                <el-button type="primary" @click="onSubmit()" size="small" :loading="loading">保存</el-button>
+            </div>
+        </div>
+    </div>
+  </div>
+</template>
+
+<script>
+//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》from ‘《组件路径》';
+import Header from "../../components/Header.vue";
+import NavMenu from "../../components/NavMenu.vue"
+import Breadcrumb from '../../components/Breadcrumb.vue';
+import { getLogin } from "@/api/ajax";
+
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: { Header, NavMenu, Breadcrumb },
+  props: {},
+  data() {
+    //这里存放数据
+    return {
+        activeMenuIndex: "discount_setting",
+        breadcrumbList:[
+            {
+                icon:'setting',
+                url:'',
+                text:''
+            },
+            {
+                icon:'',
+                url:'',
+                notLink: true,
+                text:'系统配置'
+            },
+            {
+                icon:'',
+                url:'',
+                text:'折扣规则'
+            }
+        ],
+        loading: false,
+        rule_list: [
+            {
+                buy_count: null,
+                discount: null
+            }
+        ]
+    }
+  },
+  //计算属性 类似于data概念
+  computed: {
+    
+  },
+  //监控data中数据变化
+  watch: {
+    
+  },
+  //方法集合
+  methods: {
+    handleInput(item,fild){
+        let value=item[fild].replace(/^(0+)|[^0-9]+/g,'')
+        item[fild] = value!==''?Number(value):null
+    },
+    handleInputLittle(item,fild){
+        let value=item[fild]
+        value = value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+        value = value.replace(/^\./g, ""); //验证第一个字符是数字而不是
+        value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
+        value = value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+        value = value.replace(/^(\-)*(\d+)\.(\d).*$/, '$1$2.$3'); //只能输入一个小数
+        item[fild] = value
+    },
+    handleInputLittleBlur(item,fild){
+        let value=item[fild].toString()
+        if(value){
+            let list = value.split('.')
+            if(list[0]>=10){
+                this.$message.warning('折扣不能大于10')
+                list[0]=list[0].substring(list[0].length-1)
+            }
+            item[fild]=parseFloat(list[0]+(list[1]?'.'+list[1]:''))
+        }   
+    },
+    // 提交表单
+    onSubmit(){
+        if(this.rule_list.length===0||this.rule_list[this.rule_list.length-1].buy_count&&this.rule_list[this.rule_list.length-1].discount){
+            this.loading = true
+            let MethodName = "/OrgServer/Manager/SysConfigManager/SetSysConfig_DiscountRule";
+            let data = {
+                rule_list: this.rule_list
+            }
+            getLogin(MethodName, data)
+            .then((res) => {
+                if(res.status===1){
+                    this.loading = false
+                    this.$message.success('保存成功')
+                }
+            }).catch((res) =>{
+                this.loading = false
+            })
+        }else{
+            this.$message.warning('请填写完整')
+            return false
+        }
+    },
+    // 得到配置信息
+    getInfo(){
+        let MethodName = "/OrgServer/Manager/SysConfigManager/GetSysConfig_DiscountRule";
+        getLogin(MethodName, {})
+        .then((res) => {
+            if(res.status===1){
+                if(res.rule_list.length>0){
+                    this.rule_list = res.rule_list
+                }
+            }
+        }).catch((res) =>{
+            
+        })
+    },
+    handleDelete(index){
+        this.rule_list.splice(index, 1);
+    },
+    handleAdd(){
+        if(this.rule_list.length===0||this.rule_list[this.rule_list.length-1].buy_count&&this.rule_list[this.rule_list.length-1].discount){
+            this.rule_list.push({
+                buy_count: null,
+                discount: null
+            })
+        }else{
+            this.$message.warning('请填写完整')
+        }
+    }
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    this.getInfo()
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  },
+  //生命周期-创建之前
+  beforeCreated() { },
+  //生命周期-挂载之前
+  beforeMount() { },
+  //生命周期-更新之前
+  beforUpdate() { },
+  //生命周期-更新之后
+  updated() { },
+  //生命周期-销毁之前
+  beforeDestory() { },
+  //生命周期-销毁完成
+  destoryed() { },
+  //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() { }
+}
+</script>
+<style lang="scss" scoped>
+/* @import url(); 引入css类 */
+.create-bottom{
+    padding: 40px 40px;
+    margin-top: 16px;
+    background: #FFFFFF;
+    border-radius: 4px;
+    height: calc(100vh - 140px);
+    overflow: auto;
+    h3{
+        font-size: 20px;
+        font-weight: 500;
+        line-height: 28px;
+        margin: 0 0 28px 0;
+        color: #1D2129;
+    }
+    ul{
+        list-style: none;
+        padding: 0;
+        li{
+            margin-bottom: 8px;
+        }
+        .el-icon-delete{
+            cursor: pointer;
+        }
+    }
+    a{
+        color: #175DFF;
+        font-size: 14px;
+        line-height: 22px; 
+        margin-bottom: 8px;
+        display: inline-block;
+    }
+}
+</style>
+
+<style lang="scss">
+.discount-rules{
+    .rule-item{
+        width: 100px;
+        margin-right: 8px;
+        .el-input-group__append{
+            border: none;
+            border-left: 1px solid #E5E6EB;
+            background: #F2F3F5;
+            padding: 0 10px;
+        }
+        input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
+            -webkit-appearance: none !important;
+        }
+    }
+}
+</style>

+ 171 - 0
src/views/system_config/ShareSetting.vue

@@ -0,0 +1,171 @@
+<template>
+  <div class="manage-root personnel-create">
+    <Header />
+    <div class="manage-root-contain">
+        <nav-menu class="manage-root-contain-left" :activeMenuIndex="activeMenuIndex"></nav-menu>
+        <div class="manage-root-contain-right">
+            <breadcrumb :breadcrumbList="breadcrumbList" class="breadcrumb-box"></breadcrumb>
+            <div class="create-bottom">
+                <h3>分享路径</h3>
+                <el-form :model="registerForm" :rules="rulesRegister" ref="registerForm" label-width="100px" class="registerForm" label-position="top">
+                    <el-form-item label="" prop="article_share_url_path">
+                        <el-input v-model="registerForm.article_share_url_path" autocomplete="off" placeholder="请输入分享路径" @blur="handleTrim('registerForm','article_share_url_path')" >
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item>
+                        <el-button type="primary" @click="onSubmit('registerForm')" size="small" :loading="loading">保存</el-button>
+                        <el-button @click="onCancel('registerForm')" size="small">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+  </div>
+</template>
+
+<script>
+//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》from ‘《组件路径》';
+import Header from "../../components/Header.vue";
+import NavMenu from "../../components/NavMenu.vue"
+import Breadcrumb from '../../components/Breadcrumb.vue';
+import { getLogin } from "@/api/ajax";
+
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: { Header, NavMenu, Breadcrumb },
+  props: {},
+  data() {
+    //这里存放数据
+    return {
+        activeMenuIndex: "share_setting",
+        breadcrumbList:[
+            {
+                icon:'setting',
+                url:'',
+                text:''
+            },
+            {
+                icon:'',
+                url:'',
+                notLink: true,
+                text:'系统配置'
+            },
+            {
+                icon:'',
+                url:'',
+                text:'分享路径'
+            }
+        ],
+        registerForm:{
+            article_share_url_path: ''
+        },
+        rulesRegister:{
+        },
+        newPwdFlag: false, // 查看新密码
+        loading: false
+    }
+  },
+  //计算属性 类似于data概念
+  computed: {
+    
+  },
+  //监控data中数据变化
+  watch: {
+    
+  },
+  //方法集合
+  methods: {
+    // 去掉前后空格
+    handleTrim(form,fild){
+        this[form][fild] = this[form][fild].trim()
+    },
+    changeIcon(flag){
+        this[flag] = !this[flag]
+    },
+    // 提交表单
+    onSubmit(formName){
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            let MethodName = "/OrgServer/Manager/SysConfigManager/SetSysConfig_SharePath";
+            let data = {
+                article_share_url_path: this.registerForm.article_share_url_path
+            }
+            getLogin(MethodName, data)
+            .then((res) => {
+                this.loading = false
+                if(res.status===1){
+                    this.$message.success("保存成功")
+                }
+            }).catch((res) =>{
+                this.loading = false
+            })
+          } else {
+            return false;
+          }
+        });
+    },
+    // 取消 恢复到修改前状态
+    onCancel(formName){
+        this.$refs[formName].resetFields();
+    },
+    // 得到配置信息
+    getInfo(){
+        let MethodName = "/OrgServer/Manager/SysConfigManager/GetSysConfig_SharePath";
+        getLogin(MethodName, {})
+        .then((res) => {
+            if(res.status===1){
+                this.registerForm.article_share_url_path = res.article_share_url_path
+            }
+        }).catch((res) =>{
+            
+        })
+    }
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    this.getInfo()
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  },
+  //生命周期-创建之前
+  beforeCreated() { },
+  //生命周期-挂载之前
+  beforeMount() { },
+  //生命周期-更新之前
+  beforUpdate() { },
+  //生命周期-更新之后
+  updated() { },
+  //生命周期-销毁之前
+  beforeDestory() { },
+  //生命周期-销毁完成
+  destoryed() { },
+  //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() { }
+}
+</script>
+<style lang="scss" scoped>
+/* @import url(); 引入css类 */
+.create-bottom{
+    padding: 40px 40px;
+    margin-top: 16px;
+    background: #FFFFFF;
+    border-radius: 4px;
+    height: calc(100vh - 140px);
+    overflow: auto;
+    h3{
+        font-size: 20px;
+        font-weight: 500;
+        line-height: 28px;
+        margin: 0 0 28px 0;
+        color: #1D2129;
+    }
+}
+</style>
+
+<style lang="scss">
+
+</style>