Selaa lähdekoodia

客户等级设置修改

jk-GitHub-coder 4 vuotta sitten
vanhempi
commit
3393721ac7

+ 55 - 9
Yijia-SaaS/yijia-customer/src/main/java/com/yijia/customer/controller/CustomerGradeSettingController.java

@@ -1,16 +1,13 @@
 package com.yijia.customer.controller;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.yijia.common.annotation.Log;
 import com.yijia.common.core.controller.BaseController;
 import com.yijia.common.core.domain.AjaxResult;
@@ -22,7 +19,7 @@ import com.yijia.common.core.page.TableDataInfo;
 
 /**
  * 客户优惠等级设置Controller
- * 
+ *
  * @author yijia
  * @date 2020-12-21
  */
@@ -33,6 +30,55 @@ public class CustomerGradeSettingController extends BaseController
     @Autowired
     private ICustomerGradeSettingService customerGradeSettingService;
 
+    /*
+     * 查询成长规则列表
+     */
+    @RequestMapping("/getGrouthRuleList")
+    public TableDataInfo getGrouthRuleList(){
+        //分页
+        startPage();
+        List<Map<String, Object>> grouthRuleList = customerGradeSettingService.getGrouthRuleList();
+        return getDataTable(grouthRuleList);
+    }
+
+    /*
+     * 新增成长规则
+     */
+    @RequestMapping("/addGrouthRule")
+    public AjaxResult addGrouthRule(@RequestBody  JSONObject jsonObject){
+        Map<String, Object> params = new HashMap();
+        params.put("grouthValueName", jsonObject.get("grouthValueName"));
+        params.put("grouthValueConsume", jsonObject.get("grouthValueConsume"));
+        params.put("grouthValue", jsonObject.get("grouthValue"));
+        int i = customerGradeSettingService.insertGrouthRule(params);
+        return toAjax(i);
+    }
+
+    /*
+     * 新增成长规则
+     */
+    @RequestMapping("/editGrouthRule")
+    public AjaxResult editGrouthRule(@RequestBody  JSONObject jsonObject){
+        Map<String, Object> params = new HashMap();
+        params.put("id", jsonObject.get("id"));
+        params.put("grouthValueName", jsonObject.get("grouthValueName"));
+        params.put("grouthValueConsume", jsonObject.get("grouthValueConsume"));
+        params.put("grouthValue", jsonObject.get("grouthValue"));
+        int i = customerGradeSettingService.updateGrouthRule(params);
+        return toAjax(i);
+    }
+
+    /*
+     * 删除成长规则
+     */
+    @RequestMapping("/delGrouthRule")
+    public AjaxResult delGrouthRule(@PathVariable Long[] ids){
+        int i = customerGradeSettingService.deleteGrouthRuleByIds(ids);
+        return toAjax(i);
+    }
+
+
+
     /**
      * 查询客户优惠等级设置列表
      */

+ 39 - 8
Yijia-SaaS/yijia-customer/src/main/java/com/yijia/customer/mapper/CustomerGradeSettingMapper.java

@@ -1,19 +1,50 @@
 package com.yijia.customer.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.yijia.customer.domain.CustomerGradeSetting;
 
 /**
  * 客户优惠等级设置Mapper接口
- * 
+ *
  * @author yijia
  * @date 2020-12-21
  */
-public interface CustomerGradeSettingMapper 
+public interface CustomerGradeSettingMapper
 {
+    /*
+     * 查询成长规则列表
+     * @return
+     */
+    public List<Map<String, Object>> getGrouthRuleList();
+
+    /*
+     * 跟新成长规则
+     * @return
+     */
+    public int insertGrouthRule(Map map);
+
+    /*
+     * 更新成长规则
+     * @return
+     */
+    public int updateGrouthRule(Map map);
+
+    /*
+     * 根据ID删除成长规则
+     * @return
+     */
+    public int deleteGrouthRuleById(long id);
+
+    /*
+     * 批量删除成长规则
+     * @return
+     */
+    public int deleteGrouthRuleByIds(Long[] ids);
     /**
      * 查询客户优惠等级设置
-     * 
+     *
      * @param id 客户优惠等级设置ID
      * @return 客户优惠等级设置
      */
@@ -21,7 +52,7 @@ public interface CustomerGradeSettingMapper
 
     /**
      * 查询客户优惠等级设置列表
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 客户优惠等级设置集合
      */
@@ -29,7 +60,7 @@ public interface CustomerGradeSettingMapper
 
     /**
      * 新增客户优惠等级设置
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 结果
      */
@@ -37,7 +68,7 @@ public interface CustomerGradeSettingMapper
 
     /**
      * 修改客户优惠等级设置
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 结果
      */
@@ -45,7 +76,7 @@ public interface CustomerGradeSettingMapper
 
     /**
      * 删除客户优惠等级设置
-     * 
+     *
      * @param id 客户优惠等级设置ID
      * @return 结果
      */
@@ -53,7 +84,7 @@ public interface CustomerGradeSettingMapper
 
     /**
      * 批量删除客户优惠等级设置
-     * 
+     *
      * @param ids 需要删除的数据ID
      * @return 结果
      */

+ 43 - 8
Yijia-SaaS/yijia-customer/src/main/java/com/yijia/customer/service/ICustomerGradeSettingService.java

@@ -1,19 +1,54 @@
 package com.yijia.customer.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.yijia.customer.domain.CustomerGradeSetting;
 
 /**
  * 客户优惠等级设置Service接口
- * 
+ *
  * @author yijia
  * @date 2020-12-21
  */
-public interface ICustomerGradeSettingService 
+public interface ICustomerGradeSettingService
 {
+
+    /*
+     * 查询成长规则列表
+     * @return
+     */
+    public List<Map<String, Object>>  getGrouthRuleList();
+
+    /*
+     * 跟新成长规则
+     * @return
+     */
+    public int insertGrouthRule(Map map);
+
+    /*
+     * 更新成长规则
+     * @return
+     */
+    public int updateGrouthRule(Map map);
+
+    /*
+     * 根据ID删除成长规则
+     * @return
+     */
+    public int deleteGrouthRuleById(Long id);
+
+    /*
+     * 批量删除成长规则
+     * @return
+     */
+    public int deleteGrouthRuleByIds(Long[] ids);
+
+
+
     /**
      * 查询客户优惠等级设置
-     * 
+     *
      * @param id 客户优惠等级设置ID
      * @return 客户优惠等级设置
      */
@@ -21,7 +56,7 @@ public interface ICustomerGradeSettingService
 
     /**
      * 查询客户优惠等级设置列表
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 客户优惠等级设置集合
      */
@@ -29,7 +64,7 @@ public interface ICustomerGradeSettingService
 
     /**
      * 新增客户优惠等级设置
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 结果
      */
@@ -37,7 +72,7 @@ public interface ICustomerGradeSettingService
 
     /**
      * 修改客户优惠等级设置
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 结果
      */
@@ -45,7 +80,7 @@ public interface ICustomerGradeSettingService
 
     /**
      * 批量删除客户优惠等级设置
-     * 
+     *
      * @param ids 需要删除的客户优惠等级设置ID
      * @return 结果
      */
@@ -53,7 +88,7 @@ public interface ICustomerGradeSettingService
 
     /**
      * 删除客户优惠等级设置信息
-     * 
+     *
      * @param id 客户优惠等级设置ID
      * @return 结果
      */

+ 55 - 8
Yijia-SaaS/yijia-customer/src/main/java/com/yijia/customer/service/impl/CustomerGradeSettingServiceImpl.java

@@ -1,6 +1,8 @@
 package com.yijia.customer.service.impl;
 
 import java.util.List;
+import java.util.Map;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.yijia.customer.mapper.CustomerGradeSettingMapper;
@@ -9,19 +11,64 @@ import com.yijia.customer.service.ICustomerGradeSettingService;
 
 /**
  * 客户优惠等级设置Service业务层处理
- * 
+ *
  * @author yijia
  * @date 2020-12-21
  */
 @Service
-public class CustomerGradeSettingServiceImpl implements ICustomerGradeSettingService 
+public class CustomerGradeSettingServiceImpl implements ICustomerGradeSettingService
 {
     @Autowired
     private CustomerGradeSettingMapper customerGradeSettingMapper;
 
+    /*
+     * 查询成长规则列表
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getGrouthRuleList() {
+        return customerGradeSettingMapper.getGrouthRuleList();
+    }
+
+    /*
+     * 跟新成长规则
+     * @return
+     */
+    @Override
+    public int insertGrouthRule(Map map) {
+        return customerGradeSettingMapper.insertGrouthRule(map);
+    }
+
+    /*
+     * 更新成长规则
+     * @return
+     */
+    @Override
+    public int updateGrouthRule(Map map) {
+        return customerGradeSettingMapper.updateGrouthRule(map);
+    }
+
+    /*
+     * 根据ID删除成长规则
+     * @return
+     */
+    @Override
+    public int deleteGrouthRuleById(Long id) {
+        return customerGradeSettingMapper.deleteGrouthRuleById(id);
+    }
+
+    /*
+     * 批量删除成长规则
+     * @return
+     */
+    @Override
+    public int deleteGrouthRuleByIds(Long[] ids) {
+        return customerGradeSettingMapper.deleteGrouthRuleByIds(ids);
+    }
+
     /**
      * 查询客户优惠等级设置
-     * 
+     *
      * @param id 客户优惠等级设置ID
      * @return 客户优惠等级设置
      */
@@ -33,7 +80,7 @@ public class CustomerGradeSettingServiceImpl implements ICustomerGradeSettingSer
 
     /**
      * 查询客户优惠等级设置列表
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 客户优惠等级设置
      */
@@ -45,7 +92,7 @@ public class CustomerGradeSettingServiceImpl implements ICustomerGradeSettingSer
 
     /**
      * 新增客户优惠等级设置
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 结果
      */
@@ -57,7 +104,7 @@ public class CustomerGradeSettingServiceImpl implements ICustomerGradeSettingSer
 
     /**
      * 修改客户优惠等级设置
-     * 
+     *
      * @param customerGradeSetting 客户优惠等级设置
      * @return 结果
      */
@@ -69,7 +116,7 @@ public class CustomerGradeSettingServiceImpl implements ICustomerGradeSettingSer
 
     /**
      * 批量删除客户优惠等级设置
-     * 
+     *
      * @param ids 需要删除的客户优惠等级设置ID
      * @return 结果
      */
@@ -81,7 +128,7 @@ public class CustomerGradeSettingServiceImpl implements ICustomerGradeSettingSer
 
     /**
      * 删除客户优惠等级设置信息
-     * 
+     *
      * @param id 客户优惠等级设置ID
      * @return 结果
      */

+ 64 - 7
Yijia-SaaS/yijia-customer/src/main/resources/mapper/customer/CustomerGradeSettingMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yijia.customer.mapper.CustomerGradeSettingMapper">
-    
+
     <resultMap type="CustomerGradeSetting" id="CustomerGradeSettingResult">
         <result property="id"    column="id"    />
         <result property="grade"    column="grade"    />
@@ -24,9 +24,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select id, grade, discount_way, gasoil_discount_litre, dieseloil_discount_litre, grade_type, gasoil_consume, gasoil_growth_value, dieseloil_consume, dieseloil_growth_value, growth_value, date, deduction_growth_value from customer_grade_setting
     </sql>
 
+    <!-- 查询成长规则列表-->
+    <select id="getGrouthRuleList" resultType="map">
+        SELECT
+            id,
+            grouth_value_name    AS grouthValueName,
+            grouth_value_consume AS grouthValueConsume,
+            grouth_value         AS grouthValue
+        FROM
+            customer_grouth_rule
+    </select>
+
+    <!--新增成长规则-->
+    <insert id="insertGrouthRule" parameterType="map">
+        insert into customer_grouth_rule
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="grouthValueName != null">grouth_value_name,</if>
+            <if test="grouthValueConsume != null">grouth_value_consume,</if>
+            <if test="grouthValue != null">grouth_value</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="grouthValueName != null">#{grouthValueName},</if>
+            <if test="grouthValueConsume != null">#{grouthValueConsume},</if>
+            <if test="grouthValue != null">#{grouthValue}</if>
+        </trim>
+    </insert>
+
+    <!-- 更新成长规则-->
+    <update id="updateGrouthRule" parameterType="map">
+        UPDATE customer_grouth_rule
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="grouthValueName != null">grouth_value_name = #{grouthValueName},</if>
+            <if test="grouthValueConsume != null">grouth_value_consume = #{grouthValueConsume},</if>
+            <if test="grouthValue != null">grouth_value = #{grouthValue}</if>
+        </trim>
+        WHERE id = #{id}
+    </update>
+
+    <!--删除一条成长规则-->
+    <delete id="deleteGrouthRuleById" parameterType="Long">
+        DELETE
+        FROM
+            customer_grouth_rule
+        WHERE id = #{id}
+    </delete>
+
+    <!--批量删除成长规则-->
+    <delete id="deleteGrouthRuleByIds" parameterType="Long">
+        DELETE
+        FROM
+            customer_grouth_rule
+        WHERE id IN
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+
     <select id="selectCustomerGradeSettingList" parameterType="CustomerGradeSetting" resultMap="CustomerGradeSettingResult">
         <include refid="selectCustomerGradeSettingVo"/>
-        <where>  
+        <where>
             <if test="grade != null  and grade != ''"> and grade = #{grade}</if>
             <if test="discountWay != null  and discountWay != ''"> and discount_way = #{discountWay}</if>
             <if test="gasoilDiscountLitre != null  and gasoilDiscountLitre != ''"> and gasoil_discount_litre = #{gasoilDiscountLitre}</if>
@@ -41,12 +98,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deductionGrowthValue != null  and deductionGrowthValue != ''"> and deduction_growth_value = #{deductionGrowthValue}</if>
         </where>
     </select>
-    
+
     <select id="selectCustomerGradeSettingById" parameterType="Long" resultMap="CustomerGradeSettingResult">
         <include refid="selectCustomerGradeSettingVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertCustomerGradeSetting" parameterType="CustomerGradeSetting">
         insert into customer_grade_setting
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -105,10 +162,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteCustomerGradeSettingByIds" parameterType="String">
-        delete from customer_grade_setting where id in 
+        delete from customer_grade_setting where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
-    
-</mapper>
+
+</mapper>

+ 35 - 0
Yijia-SaaS/yijia-ui/src/api/customer/setting.js

@@ -1,5 +1,40 @@
 import request from '@/utils/request'
 
+//查询成长规则列表
+export function getGrouthRuleList() {
+  return request({
+    url: '/customer/setting/getGrouthRuleList',
+    method: 'get',
+  })
+}
+
+//新增成长规则
+export function addGrouthRule(data) {
+  return request({
+    url: '/customer/setting/addGrouthRule',
+    method: 'post',
+    data: data
+  })
+}
+//编辑成长规则
+export function editGrouthRule(data) {
+  return request({
+    url: '/customer/setting/editGrouthRule',
+    method: 'post',
+    data: data
+  })
+}
+
+//删除成长规则
+export function delGrouthRule(id) {
+  return request({
+    url: '/customer/setting/delGrouthRule' + id,
+    method: 'post',
+  })
+}
+
+
+
 // 查询客户优惠等级设置列表
 export function listSetting(query) {
   return request({

+ 215 - 76
Yijia-SaaS/yijia-ui/src/views/customer/setting/index.vue

@@ -1,11 +1,10 @@
 <template>
-  <div class="app-container">
+  <div class="app-container" style="padding-top: 5px;">
 <!--固态等级-->
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item>
-        <el-button icon="el-icon-refresh" size="mini" @click="handleAdd" v-hasPermi="['customer:setting:add']" >添加等级</el-button>
-      </el-form-item>
-    </el-form>
+    <p style="margin: 5px"><span class="textlineHeader">固定等级</span>
+      <el-button class="settingButton" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['customer:setting:add']" >添加固定等级</el-button>
+    </p>
+    <div class="cutLine firstLine"></div>
     <el-table v-loading="loading" :data="settingList" >
       <el-table-column label="id" align="center" prop="id" v-if="false"/>
       <el-table-column label="等级名称" align="center" prop="grade" />
@@ -55,33 +54,79 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+    <!--成长规则-->
+    <p style="margin-left: 5px; margin-top: 25px; margin-bottom: 5px;">
+      <span class="textlineHeader">成长规则</span>
+      <el-button icon="el-icon-plus" size="mini" @click="handleAddGrouthRules" class="settingButton">添加成长规则</el-button>
+    </p>
+    <div class="cutLine secLine"></div>
+    <el-table v-loading="loading" :data="grouthRuleList" >
+      <el-table-column label="id" align="center" prop="id" v-if="false" />
+      <el-table-column label="成长规则名称" align="center" prop="grouthValueName" />
+      <el-table-column label="消费值" align="center" prop="grouthValueConsume" />
+      <el-table-column label="成长值" align="center" prop="grouthValue" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope2">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="grouthRuleUpdate(scope2.row)"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="grouthRuleDelete(scope2.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!--添加或修改成长规则-->
+    <el-dialog :title="title" :visible.sync="openGrouthRule" width="500px" append-to-body>
+      <el-form ref="formGrouthRule" :model="formGrouthRule" :rules="grouthRules" label-width="100px">
+        <el-form-item label="成长规则名称" prop="grouthValueName">
+          <el-input v-model="formGrouthRule.grouthValueName" placeholder="请输入成长规则名称" />
+        </el-form-item>
+        <el-form-item label="消费值" prop="grouthValueConsume">
+          <el-input v-model="formGrouthRule.grouthValueConsume" placeholder="请输入消费值" />
+        </el-form-item>
+        <el-form-item label="成长值" prop="grouthValue">
+          <el-input v-model="formGrouthRule.grouthValue" placeholder="请输入成长值" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFormGrouthRule">确 定</el-button>
+        <el-button @click="cancelGrouthRule">取 消</el-button>
+      </div>
+    </el-dialog>
 
-    <el-form ref="ruleForm" :model="ruleForm" :inline="true" label-width="100px" >
-      <el-row>
-        <el-col :span="6">
-          <el-form-item label="汽油消费"  prop="gasoilConsume">
-            <el-input size="small" v-model="ruleForm.gasoilConsume" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="获得成长值"  prop="gasoilGrowthValue">
-            <el-input size="small" v-model="ruleForm.gasoilGrowthValue" />
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="6">
-          <el-form-item label="柴油消费"  prop="dieseloilConsume">
-            <el-input size="small" v-model="ruleForm.dieseloilConsume" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="获得成长值"  prop="dieseloilGrowthValue">
-            <el-input size="small" v-model="ruleForm.dieseloilGrowthValue" />
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row>
+<!--    <el-form ref="ruleForm" :model="ruleForm" inline="true" label-width="110px">-->
+<!--      <el-row>-->
+<!--        <el-col :span="6">-->
+<!--          <el-form-item label="汽油消费"  prop="gasoilConsume">-->
+<!--            <el-input size="small" v-model="ruleForm.gasoilConsume" />-->
+<!--          </el-form-item>-->
+<!--        </el-col>-->
+<!--        <el-col :span="6">-->
+<!--          <el-form-item label="获得成长值"  prop="gasoilGrowthValue">-->
+<!--            <el-input size="small" v-model="ruleForm.gasoilGrowthValue" />-->
+<!--          </el-form-item>-->
+<!--        </el-col>-->
+<!--      </el-row>-->
+<!--      <el-row>-->
+<!--        <el-col :span="6">-->
+<!--          <el-form-item label="柴油消费"  prop="dieseloilConsume">-->
+<!--            <el-input size="small" v-model="ruleForm.dieseloilConsume" />-->
+<!--          </el-form-item>-->
+<!--        </el-col>-->
+<!--        <el-col :span="6">-->
+<!--          <el-form-item label="获得成长值"  prop="dieseloilGrowthValue">-->
+<!--            <el-input size="small" v-model="ruleForm.dieseloilGrowthValue" />-->
+<!--          </el-form-item>-->
+<!--        </el-col>-->
+<!--      </el-row>-->
+<!--      <el-row>-->
 <!--        <el-col :span="6">-->
 <!--          <el-form-item label="会员充值"  prop="memberRecharge">-->
 <!--            <el-input size="small" v-model="ruleForm.memberRecharge" />-->
@@ -92,27 +137,14 @@
 <!--            <el-input size="small" v-model="ruleForm.memberGrowthValue" />-->
 <!--          </el-form-item>-->
 <!--        </el-col>-->
-      </el-row>
-      <el-row v-show="false">
-        <el-col :span="6">
-          <el-form-item label="id"  prop="id">
-            <el-input size="small" v-model="ruleForm.id" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-        </el-col>
-      </el-row>
-    </el-form>
-    <div slot="footer" class="dialog-footer">
-      <el-button type="primary" @click="submitForm">保存</el-button>
-    </div>
+<!--      </el-row>-->
+<!--    </el-form>-->
 
     <!--动态等级-->
-    <el-form :model="selectParams" ref="selectFrom" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item>
-        <el-button icon="el-icon-refresh" size="mini" @click="handleAddDT" v-hasPermi="['customer:setting:add']" >添加动态等级</el-button>
-      </el-form-item>
-    </el-form>
+    <p style="margin-left: 5px; margin-top: 25px;"><span class="textlineHeader">动态等级</span>
+      <el-button class="settingButton" icon="el-icon-plus" size="mini" @click="handleAddDT" v-hasPermi="['customer:setting:add']" >添加动态等级</el-button>
+    </p>
+    <div class="cutLine"></div>
     <el-table v-loading="loading" :data="DTsettingList" >
       <el-table-column label="id" align="center" prop="id" v-if="false" />
       <el-table-column label="等级名称" align="center" prop="grade" />
@@ -183,7 +215,7 @@
 </template>
 
 <script>
-import { listSetting, getSetting, delSetting, addSetting, updateSetting, exportSetting } from "@/api/customer/setting";
+import { listSetting, getGrouthRuleList, addGrouthRule, editGrouthRule, delGrouthRule, getSetting, delSetting, addSetting, updateSetting, exportSetting } from "@/api/customer/setting";
 
 export default {
   name: "Setting",
@@ -202,6 +234,8 @@ export default {
       // 总条数
       total: 0,
       // 客户优惠等级设置表格数据
+      ruleList: [],
+      grouthRuleList:[],
       settingList: [],
       DTsettingList: [],
       // 弹出层标题
@@ -209,6 +243,7 @@ export default {
       // 是否显示弹出层
       open: false,
       opendt: false,
+      openGrouthRule: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -218,11 +253,13 @@ export default {
         gasoilDiscountLitre: null,
         dieseloilDiscountLitre: null,
         gradeType: null,
-        gasoilConsume: null,
-        gasoilGrowthValue: null,
-        dieseloilConsume: null,
-        dieseloilGrowthValue: null,
-        growthValue: null,
+        grouthValueName: null,
+        grouthValueConsume: null,
+        grouthValue: null,
+        // gasoilConsume: null,
+        // gasoilGrowthValue: null,
+        // dieseloilConsume: null,
+        // dieseloilGrowthValue: null,
         date: null,
         deductionGrowthValue: null
       },// 查询参数
@@ -235,29 +272,33 @@ export default {
         gasoilDiscountLitre: null,
         dieseloilDiscountLitre: null,
         gradeType: null,
-        gasoilConsume: null,
-        gasoilGrowthValue: null,
-        dieseloilConsume: null,
-        dieseloilGrowthValue: null,
-        growthValue: null,
+        grouthValueName: null,
+        grouthValueConsume: null,
+        grouthValue: null,
+        // gasoilConsume: null,
+        // gasoilGrowthValue: null,
+        // dieseloilConsume: null,
+        // dieseloilGrowthValue: null,
         date: null,
         deductionGrowthValue: null
       },
       // 表单参数
       form: {},
+      formGrouthRule:{},
       dtform: {},
       ruleForm: {},
       // 表单校验
       rules: {
       },
+      grouthRules: {},
       dtrules: {
       }
     };
   },
   created() {
     this.getList();
+    this.getRuleList();
     this.getList2();
-    this.getList3();
   },
   methods: {
     /** 查询客户优惠等级设置列表 */
@@ -270,6 +311,7 @@ export default {
         this.loading = false;
       });
     },
+
     getList2() {
       this.selectParams.gradeType="3";
       this.loading = true;
@@ -280,18 +322,12 @@ export default {
 
       });
     },
-    getList3() {
-      this.selectParams.gradeType="2";
-      this.loading = true;
-      listSetting(this.selectParams).then(response => {
-        this.ruleForm  = response.data;
-      });
-    },
     // 取消按钮
     cancel() {
       this.open = false;
       this.reset();
     },
+
     // 取消按钮
     cancelDT() {
       this.opendt = false;
@@ -306,15 +342,18 @@ export default {
         gasoilDiscountLitre: null,
         dieseloilDiscountLitre: null,
         gradeType: null,
-        gasoilConsume: null,
-        gasoilGrowthValue: null,
-        dieseloilConsume: null,
-        dieseloilGrowthValue: null,
-        growthValue: null,
+        grouthValueName: null,
+        grouthValueConsume: null,
+        grouthValue: null,
+        // gasoilConsume: null,
+        // gasoilGrowthValue: null,
+        // dieseloilConsume: null,
+        // dieseloilGrowthValue: null,
         date: null,
         deductionGrowthValue: null
       };
       this.resetForm("form");
+      //this.resetForm("formGrouthRule");
     },
 
     /** 新增按钮操作 */
@@ -333,6 +372,81 @@ export default {
         this.title = "修改客户优惠等级设置";
       });
     },
+
+    //查询成长规则列表
+    getRuleList() {
+      this.loading = true;
+      getGrouthRuleList(this.selectParams).then(response => {
+        this.grouthRuleList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+
+    //打开新增成长规则窗口
+    handleAddGrouthRules(){
+      this.reset();
+      this.openGrouthRule = true;
+      this.title = "添加成长规则";
+    },
+    //打开修改成长规则窗口
+    grouthRuleUpdate(row){
+      this.reset();
+      this.formGrouthRule = row;
+      this.openGrouthRule = true;
+      this.title = "修改成长规则";
+      //const id = row.id
+      // editGrouthRule(id).then(response => {
+      //   this.formGrouthRule = response.data;
+      //   this.openGrouthRule = true;
+      //   this.title = "修改成长规则"
+      // });
+    },
+
+    //取消按钮
+    cancelGrouthRule(){
+      this.openGrouthRule = false;
+      this.reset();
+    },
+
+    //提交新增和修改成长规则
+    submitFormGrouthRule(){
+      this.$refs['formGrouthRule'].validate(valid =>{
+        if(valid){
+          if(this.formGrouthRule.id != null){
+            editGrouthRule(this.formGrouthRule).then(response =>{
+              this.msgSuccess("修改成功")
+              this.openGrouthRule = false;
+              this.getRuleList();
+            });
+          }else{
+            addGrouthRule(this.formGrouthRule).then(response =>{
+              this.msgSuccess("新增成功");
+              this.openGrouthRule =false;
+              this.getRuleList();
+            })
+          }
+        }
+      });
+    },
+
+    //删除成长规则
+    grouthRuleDelete(row){
+      const ids = row.id || this.ids
+        if(row.id !=null || this.ids != null){
+          this.$confirm('是否确认删除该成长规则的数据项?', "警告",{
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(function () {
+            delGrouthRule(ids);
+          }).then(() =>{
+              this.msgSuccess("删除成功");
+          })
+        }
+    },
+
+
     /** 新增按钮操作 */
     handleAddDT() {
       this.reset();
@@ -349,6 +463,7 @@ export default {
         this.title = "修改客户优惠等级设置";
       });
     },
+
     /** 提交按钮 */
     submitForm() {
       this.form.gradeType="1";
@@ -415,7 +530,7 @@ export default {
       }).then(function() {
         return delSetting(ids);
       }).then(() => {
-        this.getList();
+        this.getList2();
         this.msgSuccess("删除成功");
       })
     },
@@ -435,3 +550,27 @@ export default {
   }
 };
 </script>
+<style>
+  .two{
+    margin-top: 30px;
+  }
+  .settingButton{
+    border: 0px;
+    float: right;
+  }
+  .cutLine{
+    width: 65px;
+    height: 2px;
+    background: #71f332;
+    /*margin-top: 5px;*/
+    margin-left: 5px;
+    margin-bottom: 20px;
+  }
+  .textlineHeader{
+    /*margin-bottom: 20px;*/
+    font-family: Bahnschrift;
+    /*text-shadow: #32a9f3 1px 1px 1px;*/
+    /*font-size: ;*/
+    color: #32a9f3;
+  }
+</style>