فهرست منبع

轮胎补贴配置

chenrui 3 ماه پیش
والد
کامیت
a22c49ba79

+ 9 - 0
src/api/subsidyRule.js

@@ -59,3 +59,12 @@ export const endSubsidyRule = (params) => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
+
+// 编辑
+export const editSubsidyRule = (params) => {
+  return axios({
+    url: '/subsidyRule/edit',
+    data: params,
+    method: 'post'
+  })
+}

+ 36 - 0
src/config/dealerManagement.js

@@ -107,6 +107,42 @@ export default {
         }
         }
       ]
       ]
     },
     },
+    {
+      path: '/dealerManagement/dealerAccount',
+      redirect: '/dealerManagement/dealerAccount/list',
+      name: 'dealerAccount',
+      component: BlankLayout,
+      meta: {
+        title: '经销商账户',
+        icon: 'team'
+        // permission: 'M_dealerAccountList'
+      },
+      hideChildrenInMenu: true,
+      children: [
+        {
+          path: 'list',
+          name: 'dealerAccountList',
+          component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/dealerAccount/list.vue'),
+          meta: {
+            title: '经销商账户列表',
+            icon: 'team',
+            hidden: true
+            // permission: 'M_dealerAccountList'
+          }
+        },
+        {
+          path: 'detail/:sn',
+          name: 'dealerAccountDetail',
+          component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/dealerAccount/detail.vue'),
+          meta: {
+            title: '轮胎补贴金额',
+            icon: 'thunderbolt',
+            hidden: true
+            // permission: 'M_dealerAccountDetail'
+          }
+        }
+      ]
+    },
     {
     {
       path: '/promotionRulesManagement/dealerPromotions',
       path: '/promotionRulesManagement/dealerPromotions',
       redirect: '/promotionRulesManagement/dealerPromotions/list',
       redirect: '/promotionRulesManagement/dealerPromotions/list',

+ 353 - 0
src/views/dealerManagement/dealerAccount/detail.vue

@@ -0,0 +1,353 @@
+<template>
+  <div class="categorySet-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div ref="headerBar">
+        <a-page-header :ghost="false" :backIcon="false" class="header-bar">
+          <!-- 自定义的二级文字标题 -->
+          <template slot="subTitle">
+            <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+            <span class="subTitle-word text-overflow" style="max-width:300px;margin-left:15px;">轮胎补贴金额(箭冠汽配东莞店):<h3>11212121</h3></span>
+            <a-button type="danger" ghost id="settingsIndex-addArea">调账</a-button>
+            <a-button type="primary" ghost id="settingsIndex-addArea">调整记录</a-button>
+          </template>
+        </a-page-header>
+      </div>
+      <a-card size="small" :bordered="false">
+        <div class="table-page-search-wrapper newTableSearchName" >
+          <a-form layout="inline" id="settingsIndex-form" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="时间" prop="time">
+                  <rangeDate ref="rangeDate" id="actualSalesReportList-time" :value="queryParam.time" @change="dateChange" />
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="业务类型">
+                  <v-select
+                    v-model="queryParam.dealer.dealerLevel"
+                    ref="dealerLevel"
+                    id="actualSalesReportList-dealerLevel"
+                    code="DEALER_LEVEL"
+                    placeholder="请选择业务类型"
+                    allowClear></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="入账类型">
+                  <v-select
+                    v-model="queryParam.dealer.dealerLevel"
+                    ref="dealerLevel"
+                    id="actualSalesReportList-dealerLevel"
+                    code="DEALER_LEVEL"
+                    placeholder="请选择入账类型"
+                    allowClear></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="settingsIndex-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="settingsIndex-reset">重置</a-button>
+                <a-button
+                  style="margin-left: 10px"
+                  type="primary"
+                  class="button-warning"
+                  @click="handleExport"
+                  :disabled="disabled"
+                  :loading="exportLoading"
+                  v-if="$hasPermissions('B_actualSalesReport_export')"
+                  id="actualSalesReportList-export">导出</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          :style="{ height: tableHeight+70+'px' }"
+          :scroll="{ y: tableHeight }"
+          bordered>
+        </s-table>
+      </a-card>
+    </a-spin>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+// 组件
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+// 接口
+import { queryDealerScopePage, bizuserScopeDelete, findById, queryAreaScope, queryDealerScope, saveAreaScope, saveDealerScope } from '@/api/bizuser'
+export default {
+  name: 'SettingsIndex',
+  mixins: [commonMixin],
+  components: { STable, VSelect, rangeDate },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0, // 表格高度
+      disabled: false, //  查询、重置按钮是否可操作
+      // 查询参数
+      queryParam: {
+        hasDetail: 0,
+        bizType: undefined, // 区域分区区别
+        bizSn: undefined, // 当前行sn
+        dealerName: ''// 经销商
+      },
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '记账日期', dataIndex: 'createDate', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '业务类型', dataIndex: 'subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入账类型', dataIndex: 'subareaAreaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '金额(¥)', dataIndex: 'dealerName', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '备注', dataIndex: 'dealerName', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+      ],
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        this.queryParam.userSn = this.$route.query.sn
+        // 获取列表数据  有分页
+        return queryDealerScopePage(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            // 计算列表序号
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+          }
+          this.disabled = false
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    //  时间  change
+    dateChange (date) {
+      if (date[0] && date[1]) {
+        this.queryParam.time = date
+      } else {
+        this.queryParam.time = []
+      }
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    // 获取用户基本信息
+    getBaseInfo () {
+      const _this = this
+      findById({ id: _this.$route.query.id }).then(res => {
+        if (res.status == 200) {
+          _this.infoObj = res.data
+          if (res.data.allDealerFlag != 1) {
+            _this.activeKeyVal = '1'
+            _this.$nextTick(() => {
+              _this.$refs.table.refresh()
+            })
+          } else if (res.data.allDealerFlag == 1 && res.data.allProductFlag != 1) {
+            _this.activeKeyVal = '2'
+            _this.$nextTick(() => {
+              this.$refs.setCategory.pageInit()
+            })
+          } else if (res.data.allDealerFlag == 1 && res.data.allProductFlag == 1 && res.data.allSupplierFlag != 1) {
+            _this.activeKeyVal = '3'
+            _this.$nextTick(() => {
+              this.$refs.setSupplier.pageInit()
+            })
+          }
+        }
+      })
+    },
+    // 选择区域>分区
+    handleArea (con) {
+      const chooseData = con.checked
+      const newData = []
+      chooseData.forEach(item => {
+        const obj = {}
+        obj.userSn = this.$route.query.sn
+        obj.bizUserSn = this.infoObj.bizUserSn
+        if (item.indexOf('_') != -1) { // 分区获取数据带_    区域不带下划线
+          obj.bizType = 'subarea_area'
+          obj.bizSn = item.replace('_', '')
+          newData.push(obj)
+        } else {
+          obj.bizType = 'subarea'
+          obj.bizSn = item
+          newData.push(obj)
+        }
+      })
+      this.saveChooseArea(newData)
+    },
+    // 保存区域分区数据
+    saveChooseArea (list) {
+      const _this = this
+      const newAjaxData = {}
+      newAjaxData.userSn = _this.$route.query.sn
+      newAjaxData.bizUserScopeList = list
+      saveAreaScope(newAjaxData).then(res => {
+        if (res.status == 200) {
+          _this.openChooseArea = false
+          _this.resetSearchForm()
+        }
+      })
+    },
+    // tabs 选择
+    handleTabs (val) {
+      this.activeKeyVal = val
+      if (val == 2) {
+        this.$refs.setCategory.pageInit()
+      } else if (val == 3) {
+        this.$refs.setSupplier.pageInit()
+      }
+    },
+    // 所在区域分区查询
+    subareaChange (val) {
+      if (val.length == 1) {
+        this.queryParam.bizSn = val[0]
+        this.queryParam.bizType = 'subarea'
+      } else if (val.length == 2) {
+        this.queryParam.bizSn = val[1]
+        this.queryParam.bizType = 'subarea_area'
+      } else {
+        this.queryParam.bizSn = undefined
+        this.queryParam.bizType = undefined
+      }
+    },
+    // 重置
+    resetSearchForm () {
+      this.queryParam = {
+        bizSn: undefined,
+        bizType: undefined,
+        dealerName: '',
+        hasDetail: 0
+      }
+      if (this.infoObj && this.infoObj.allDealerFlag != 1) {
+        this.$refs.subarea.clearData()
+        this.$refs.table.refresh(true)
+      }
+    },
+    // 选择区域
+    async openAreaModal () {
+      const _this = this
+      const checkedArr = []
+      const dataList = await queryAreaScope({ userSn: this.$route.query.sn, hasDetail: 0 })
+      if (dataList.data && dataList.data.length > 0) {
+        dataList.data.forEach(item => {
+          if (item.bizType == 'subarea_area') {
+            item.bizSn = item.bizSn + '_'
+          }
+          checkedArr.push(item.bizSn)
+        })
+        const newCheckedArr = [...new Set(checkedArr)]
+        console.log('end choose:', newCheckedArr)
+        this.newChooseData.checked = newCheckedArr
+      } else {
+        this.newChooseData.checked = []
+      }
+      this.$refs.partQuery.pageInit()
+      _this.$nextTick(() => {
+        _this.openChooseArea = true
+      })
+    },
+    // 打开经销商弹窗
+    async openDealerModal (params = {}) {
+      const _this = this
+      const arr = []
+      const dataList = await queryDealerScope({ userSn: this.$route.query.sn, hasDetail: 0 })
+      if (dataList.data && dataList.data.length > 0) {
+        dataList.data.forEach(con => {
+          arr.push(con.bizSn)
+        })
+        _this.chooseInfo = [...new Set(arr)]
+      } else {
+        _this.chooseInfo = []
+      }
+      const dataInfo = {
+        list: _this.chooseInfo,
+        sn: _this.$route.query.sn
+      }
+      _this.openChooseDealer = true
+      if (_this.openChooseDealer) {
+        _this.$refs.dealerChoose.pageInit(dataInfo)
+      }
+    },
+    // 经销商
+    handleAddDealer (list) {
      const newData = []
      list.forEach(con => {
        const obj = {}
+        obj.userSn = this.$route.query.sn
+        obj.bizUserSn = this.infoObj.bizUserSn
        obj.bizType = 'dealer'
        obj.bizSn = con
        newData.push(obj)
      })
      this.saveChooseDealer(newData)
    },
+    // 保存所选区域或经销商
+    saveChooseDealer (list) {
+      const _this = this
+      const ajaxData = {}
+      ajaxData.userSn = _this.$route.query.sn
+      ajaxData.bizUserScopeList = list
+      saveDealerScope(ajaxData).then(res => {
+        if (res.status == 200) {
+          _this.openChooseDealer = false
+          _this.resetSearchForm()
+        }
+      })
+    },
+    //  删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?删除后当前用户权限以最新权限为准',
+        centered: true,
+        onOk () {
+          bizuserScopeDelete({ id: row.bizUserScopeSn }).then(res => {
+            if (res.status == 200) {
+              _this.resetSearchForm()
+            }
+          })
+        }
+      })
+    },
+    //  返回
+    handleBack () {
+      this.$router.push({ name: 'businessOwnerSettings' })
+    },
+    // 初始化
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      _this.getBaseInfo()
+    },
+    // 计算列表高度
+    setTableH () {
+      const headHeight = this.$refs.headerBar.offsetHeight
+      this.tableHeight = window.innerHeight - headHeight - 340
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  activated () {
+    this.pageInit()
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .categorySet-wrap{
+    .table-operator{
+    text-align:right;
+    }
+  }
+</style>

+ 214 - 0
src/views/dealerManagement/dealerAccount/list.vue

@@ -0,0 +1,214 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="dealerAccountNewList-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" id="dealerAccountNewList-form" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="5" :sm="24">
+              <a-form-item label="经销商名称">
+                <dealerSubareaScopeList placeholder="请输入经销商名称搜索" ref="dealerSubareaScopeList" id="dealerAccountNewList-senderName" @change="custChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-item label="区域">
+                <subarea id="dealerAccountNewList-subarea" ref="subarea" @change="subareaChange"></subarea>
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-item label="商户级别">
+                <v-select code="DEALER_LEVEL" id="dealerAccountNewList-dealerLevel" v-model="queryParam.dealerLevel" allowClear placeholder="请选择商户级别"></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-item label="商户类型">
+                <dealerType id="dealerAccountNewList-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="dealerAccountNewList-refresh">查询</a-button>
+              <a-button style="margin:0 5px" @click="resetSearchForm" :disabled="disabled" id="dealerAccountNewList-reset">重置</a-button>
+              <a-button
+                type="primary"
+                v-if="$hasPermissions('B_merchantInfo_export')"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                id="dealerAccountNewList-export">导出</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :style="{ height: tableHeight+70+'px' }"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :pageSize="30"
+          :scroll="{ y: tableHeight }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 轮胎补贴金额 -->
+          <template slot="moneyNum" slot-scope="text, record">
+            <span v-if="$hasPermissions('B_salesDetail')" class="link-bule" @click="handleDetail(record)">111111111111</span>
+            <span v-else>111111111111</span>
+          </template>
+        </s-table>
+      </a-spin>
+    </a-card>
+
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+// 组件
+import { STable, VSelect } from '@/components'
+import subarea from '@/views/common/subarea.js'
+import dealerType from '@/views/common/dealerType.js'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
+// 接口
+import { dealerUserList } from '@/api/dealer'
+export default {
+  name: 'DealerAccountNewList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, dealerSubareaScopeList, subarea, dealerType },
+  data () {
+    const _this = this
+    return {
+      spinning: false,
+      tableHeight: 0, // 表格高度
+      disabled: false, //  查询、重置按钮是否可操作
+      queryParam: { //  查询条件
+        dealerSn: undefined, // 经销商sn
+        subareaArea: {
+          subareaSn: undefined, //  区域
+          subareaAreaSn: undefined // 分区
+        },
+        dealerLevel: undefined, // 商户级别
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined //  商户类型
+      },
+      dealerType: [], // 所选商户类型 列表
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '经销商名称', dataIndex: 'org.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '轮胎补贴金额(¥)', scopedSlots: { customRender: 'moneyNum' }, width: '12%', align: 'center' },
+        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户类型', dataIndex: 'dealerTypeName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return dealerUserList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            // 计算表格序号
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+          }
+          this.disabled = false
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    handleDetail (row) {
+      this.$router.push({ name: 'dealerAccountDetail', params: { sn: row.salesBillSn } })
+    },
+    // 客户名称 change
+    custChange (val) {
+      this.queryParam.dealerSn = val.key
+    },
+    // 区域  change
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    // 商户类型 change
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.dealerSn = undefined
+      this.queryParam.subareaArea.subareaSn = undefined
+      this.queryParam.subareaArea.subareaAreaSn = undefined
+      this.queryParam.dealerLevel = undefined
+      this.queryParam.dealerType1 = undefined
+      this.queryParam.dealerType2 = undefined
+      this.dealerType = []
+      this.$refs.dealerSubareaScopeList.resetForm()
+      this.$refs.subarea.clearData()
+      this.$refs.table.refresh(true)
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      _this.$store.state.app.curActionPermission = 'B_sales_export'
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(salesDetailExport, _this.queryParam, '经销商账户列表', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+        _this.showExport = true
+        _this.$store.state.app.curActionPermission = ''
+      })
+    },
+    // 初始化
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    // 计算表格高度
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 200
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.$refs.table.refresh()
+      this.pageInit()
+    }
+  }
+}
+</script>

+ 169 - 31
src/views/setting/tireSubsidySetting/addSubsidyList.vue

@@ -28,9 +28,9 @@
             <a-col :md="5" :sm="24">
             <a-col :md="5" :sm="24">
               <a-form-model-item label="状态">
               <a-form-model-item label="状态">
                 <v-select
                 <v-select
-                  v-model="queryParam.status"
-                  id="addSubsidyList-status"
-                  code="DEALER_LEVEL"
+                  v-model="queryParam.subsidyQueryStatus"
+                  id="addSubsidyList-subsidyQueryStatus"
+                  code="INCREMENT_SUBSIDY_QUERY_STATUS"
                   placeholder="请选择状态"
                   placeholder="请选择状态"
                   allowClear></v-select>
                   allowClear></v-select>
               </a-form-model-item>
               </a-form-model-item>
@@ -73,6 +73,10 @@
           <template slot="customName" slot-scope="text, record">
           <template slot="customName" slot-scope="text, record">
             {{ record.dealerEntity&&record.dealerEntity.dealerName?record.dealerEntity.dealerName:record.defaultFlag==1?'默认':'--' }}
             {{ record.dealerEntity&&record.dealerEntity.dealerName?record.dealerEntity.dealerName:record.defaultFlag==1?'默认':'--' }}
           </template>
           </template>
+          <!-- 结束时间 -->
+          <template slot="endDate" slot-scope="text, record">
+            {{ record.status==='END'? record.ruleEndDate:'--' }}
+          </template>
           <!-- 操作 -->
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
           <template slot="action" slot-scope="text, record">
             <a-button
             <a-button
@@ -80,7 +84,7 @@
               type="link"
               type="link"
               class="button-info"
               class="button-info"
               @click="handleEdit(record)"
               @click="handleEdit(record)"
-              v-if="record.status=='IN_USE'"
+              v-if="record.status=='IN_USE' && record.isSomeTimeFlag"
               :id="'addSubsidyList-edit-btn'+record.id"
               :id="'addSubsidyList-edit-btn'+record.id"
             >
             >
               编辑
               编辑
@@ -89,8 +93,18 @@
               size="small"
               size="small"
               type="link"
               type="link"
               class="button-error"
               class="button-error"
-              @click="handleDel(record)"
-              v-if="record.status=='IN_USE'&&record.defaultFlag==0"
+              :id="'costCollectionList-end-btn'+record.id"
+              v-if="record.status=='IN_USE'&&record.defaultFlag==0&&!record.isSomeTimeFlag"
+              @click="handleEndOrDel(record,'end')"
+            >
+              结束
+            </a-button>
+            <a-button
+              size="small"
+              type="link"
+              class="button-error"
+              @click="handleEndOrDel(record)"
+              v-if="record.status=='IN_USE'&&record.defaultFlag==0&&record.isSomeTimeFlag"
               :id="'addSubsidyList-del-btn'+record.id"
               :id="'addSubsidyList-del-btn'+record.id"
             >
             >
               删除
               删除
@@ -100,8 +114,16 @@
         </s-table>
         </s-table>
       </a-spin>
       </a-spin>
     </a-card>
     </a-card>
-    <!-- 新增/编辑 -->
+    <!-- 新增 -->
     <add-subsidy-modal v-drag :openModal="openAddSubsidyModal" :pageType="pageType" @ok="$refs.table.refresh(true)" @close="openAddSubsidyModal = false" />
     <add-subsidy-modal v-drag :openModal="openAddSubsidyModal" :pageType="pageType" @ok="$refs.table.refresh(true)" @close="openAddSubsidyModal = false" />
+    <!-- 编辑 -->
+    <edit-modal
+      v-drag
+      :openModal="openEditSubsidyModal"
+      ref="editSubsidyModal"
+      :pageType="pageType"
+      @ok="$refs.table.refresh(true)"
+      @close="openEditSubsidyModal = false" ></edit-modal>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -112,13 +134,14 @@ import { STable, VSelect } from '@/components'
 import subarea from '@/views/common/subarea.js'
 import subarea from '@/views/common/subarea.js'
 import AreaList from '@/views/common/areaList.js'
 import AreaList from '@/views/common/areaList.js'
 import addSubsidyModal from './addSubsidyModal.vue'
 import addSubsidyModal from './addSubsidyModal.vue'
+import editModal from './editModal.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 // 接口
 // 接口
-import { tireSubsidyRuleList } from '@/api/subsidyRule'
+import { tireSubsidyRuleList, endSubsidyRule, delSubsidyRule } from '@/api/subsidyRule'
 export default {
 export default {
   name: 'AddSubsidyList',
   name: 'AddSubsidyList',
   mixins: [commonMixin],
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, addSubsidyModal },
+  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, addSubsidyModal, editModal },
   props: {
   props: {
     pageType: { //  弹框显示状态
     pageType: { //  弹框显示状态
       type: String,
       type: String,
@@ -136,16 +159,16 @@ export default {
           subareaSn: '', // 区域
           subareaSn: '', // 区域
           subareaAreaSn: '' // 分区
           subareaAreaSn: '' // 分区
         },
         },
-        customSn: undefined, // 客户sn
-        dealerEntity: {
-          dealerName: undefined, // 客户名称
-          provinceSn: undefined, // 省
-          citySn: undefined, // 市
-          districtSn: undefined // 区
-        },
-        ruleType: undefined
+        dealerSn: undefined, // 客户sn
+        dealerName: undefined, // 客户名称
+        provinceSn: undefined, // 省
+        citySn: undefined, // 市
+        districtSn: undefined, // 区
+        ruleType: undefined, // 页面类型
+        subsidyQueryStatus: 'NOT_FINISH'// 状态
       },
       },
       openAddSubsidyModal: false, // 新增弹窗
       openAddSubsidyModal: false, // 新增弹窗
+      openEditSubsidyModal: false, // 编辑弹窗
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
@@ -161,6 +184,15 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].no = no + i + 1
+              if (data.list[i].ruleStartDate) {
+                data.list[i].ruleStartDate = this.pageType === 'SUBSIDY_QUARTER_FEE' ? this.getYearAndQuarter(data.list[i].ruleStartDate).showWords : this.getYear(data.list[i].ruleStartDate)
+              }
+              if (data.list[i].ruleEndDate) {
+                data.list[i].ruleEndDate = this.pageType === 'SUBSIDY_QUARTER_FEE' ? this.getYearAndQuarter(data.list[i].ruleEndDate).showWords : this.getYear(data.list[i].ruleEndDate)
+              }
+              if (data.list[i].createDate) {
+                data.list[i].isSomeTimeFlag = this.pageType === 'SUBSIDY_QUARTER_FEE' ? this.isSameQuarter(data.list[i].ruleStartDate) : this.isSameYear(data.list[i].createDate)
+              }
             }
             }
           }
           }
           this.disabled = false
           this.disabled = false
@@ -180,12 +212,12 @@ export default {
       const _this = this
       const _this = this
       const arr = [
       const arr = [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '区域', dataIndex: 'subareaArea.subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '区域', dataIndex: 'subareaArea.subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '14%', align: 'center', scopedSlots: { customRender: 'customName' }, ellipsis: true },
         { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '14%', align: 'center', scopedSlots: { customRender: 'customName' }, ellipsis: true },
-        { title: '开始月份', dataIndex: 'ruleStartDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '结束月份', dataIndex: 'ruleEndDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '开始' + (_this.pageType === 'SUBSIDY_QUARTER_FEE' ? '季度' : '年份'), dataIndex: 'ruleStartDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '结束' + (_this.pageType === 'SUBSIDY_QUARTER_FEE' ? '季度' : '年份'), dataIndex: 'ruleEndDate', width: '14%', align: 'center', scopedSlots: { customRender: 'endDate' } },
         { title: '增量补贴(' + (_this.pageType === 'SUBSIDY_QUARTER_FEE' ? '季度)' : '年度)'),
         { title: '增量补贴(' + (_this.pageType === 'SUBSIDY_QUARTER_FEE' ? '季度)' : '年度)'),
           children: [
           children: [
             { title: '1阶目标(条)', dataIndex: 'ruleTarget1', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
             { title: '1阶目标(条)', dataIndex: 'ruleTarget1', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -195,27 +227,75 @@ export default {
             { title: '3阶目标(条)', dataIndex: 'ruleTarget3', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
             { title: '3阶目标(条)', dataIndex: 'ruleTarget3', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
             { title: '3阶补贴(元)', dataIndex: 'ruleValue3', width: '13%', align: 'right', customRender: text => { return (text || text == 0) ? _this.toThousands(text) : '--' } }
             { title: '3阶补贴(元)', dataIndex: 'ruleValue3', width: '13%', align: 'right', customRender: text => { return (text || text == 0) ? _this.toThousands(text) : '--' } }
           ] },
           ] },
-        { title: '状态', dataIndex: 'statusDictValue', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'statusDictValue', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
       ]
       ]
       return arr
       return arr
     }
     }
   },
   },
   methods: {
   methods: {
+    // 计算是第几季度
+    getYearAndQuarter (dateString) {
+      // 解析日期字符串
+      const date = new Date(dateString)
+      // 获取年份
+      const year = date.getFullYear()
+      // 获取月份
+      const month = date.getMonth() + 1 // getMonth() 返回的是0-11,所以要加1
+      // 确定季度
+      let quarter
+      if (month >= 1 && month <= 3) {
+        quarter = 1
+      } else if (month >= 4 && month <= 6) {
+        quarter = 2
+      } else if (month >= 7 && month <= 9) {
+        quarter = 3
+      } else {
+        quarter = 4
+      }
+      return { showWords: year + '年' + quarter + '季度', quarter }
+    },
+    // 获取年份
+    getYear (dateString) {
+      const year = new Date(dateString).getFullYear()
+      return year
+    },
+    // 当前时间与创建时间是否属于同一年
+    isSameYear (fixedDate) {
+      // 获取当前时间
+      const currentDate = new Date()
+      const currentYear = currentDate.getFullYear()
+
+      // 解析输入的时间
+      const inputTime = new Date(fixedDate)
+      const inputYear = inputTime.getFullYear()
+
+      // 比较年份
+      return currentYear === inputYear
+    },
+    // 当前时间与创建时间是否属于同一季度
+    isSameQuarter (inputVal) {
+      const currentDate = new Date()
+      const quarterNum = this.getYearAndQuarter(currentDate).quarter
+      // 根据正则匹配字符串中季度值
+      const inputQuarter = parseInt(inputVal.match(/(\d)季度/), 10)
+      console.log('季度值:', quarterNum, inputQuarter)
+      return quarterNum === inputQuarter
+    },
     // 新增
     // 新增
     handleAdd () {
     handleAdd () {
       this.openAddSubsidyModal = true
       this.openAddSubsidyModal = true
     },
     },
     // 客户名称 change
     // 客户名称 change
     custChange (val) {
     custChange (val) {
-      this.queryParam.dealerEntity.dealerName = val.name
-      this.queryParam.customSn = val.key
+      this.queryParam.dealerName = val.name
+      this.queryParam.dealerSn = val.key
     },
     },
     // 地区
     // 地区
     areaChange (val) {
     areaChange (val) {
-      this.queryParam.dealerEntity.provinceSn = val[0] ? val[0] : undefined
-      this.queryParam.dealerEntity.citySn = val[1] ? val[1] : undefined
-      this.queryParam.dealerEntity.districtSn = val[2] ? val[2] : undefined
+      this.queryParam.provinceSn = val[0] ? val[0] : undefined
+      this.queryParam.citySn = val[1] ? val[1] : undefined
+      this.queryParam.districtSn = val[2] ? val[2] : undefined
     },
     },
     // 区域分区  change
     // 区域分区  change
     subareaChange (val) {
     subareaChange (val) {
@@ -224,19 +304,77 @@ export default {
     },
     },
     //  重置
     //  重置
     resetSearchForm () {
     resetSearchForm () {
-      this.queryParam.dealerEntity.provinceSn = undefined
-      this.queryParam.dealerEntity.citySn = undefined
-      this.queryParam.dealerEntity.districtSn = undefined
-      this.queryParam.dealerEntity.dealerName = undefined
-      this.queryParam.customSn = undefined
+      this.queryParam.provinceSn = undefined
+      this.queryParam.citySn = undefined
+      this.queryParam.districtSn = undefined
+      this.queryParam.dealerName = undefined
+      this.queryParam.dealerSn = undefined
       this.queryParam.ruleType = undefined
       this.queryParam.ruleType = undefined
       this.queryParam.subareaArea.subareaSn = ''
       this.queryParam.subareaArea.subareaSn = ''
       this.queryParam.subareaArea.subareaAreaSn = ''
       this.queryParam.subareaArea.subareaAreaSn = ''
+      this.queryParam.subsidyQueryStatus = 'NOT_FINISH'
       this.$refs.subarea.clearData()
       this.$refs.subarea.clearData()
       this.$refs.dealerSubareaScopeList.resetForm()
       this.$refs.dealerSubareaScopeList.resetForm()
       this.$refs.areaList.clearData()
       this.$refs.areaList.clearData()
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
+    // 编辑
+    handleEdit (row) {
+      const sendData = {
+        dealerName: row.dealerEntity && row.dealerEntity.dealerName ? row.dealerEntity.dealerName : undefined,
+        defaultFlag: row.defaultFlag,
+        ruleSn: row.ruleSn,
+        ruleTarget1: row.ruleTarget1,
+        ruleValue1: row.ruleValue1,
+        ruleTarget2: row.ruleTarget2,
+        ruleValue2: row.ruleValue2,
+        ruleTarget3: row.ruleTarget3,
+        ruleValue3: row.ruleValue3
+      }
+      this.$refs.editSubsidyModal.getFormData(sendData)
+      this.openEditSubsidyModal = true
+    },
+    // 结束  删除
+    handleEndOrDel (row, type) {
+      const ajaxName = type === 'end' ? endSubsidyRule : delSubsidyRule
+      let tipWord = null
+      if (this.pageType === 'SUBSIDY_QUARTER_FEE') {
+        tipWord = '确定' + (type === 'end' ? '结束' : '删除') + '季度补贴吗?' + (type === 'end' ? '结束' : '删除') + '后以默认季度补贴计算'
+      } else {
+        tipWord = '确定' + (type === 'end' ? '结束' : '删除') + '年度增量补贴吗?' + (type === 'end' ? '结束' : '删除') + '后以默认年度增量补贴计算'
+      }
+      const _this = this
+      _this.$confirm({
+        title: '提示',
+        content: tipWord,
+        centered: true,
+        onOk () {
+          ajaxName({ ruleSn: row.ruleSn, ruleType: _this.pageType }).then(res => {
+            if (res.status == 200) {
+              if (res.data && res.data === 'FALSE') {
+                _this.$confirm({
+                  title: '提示',
+                  content: '当前规则不可操作,请刷新后重试',
+                  centered: true,
+                  okText: '知道了',
+                  cancelButtonProps: {
+                    style: {
+                      display: 'none' // 通过设置样式隐藏取消按钮
+                    }
+                  },
+                  onOk () {
+                    console.log('知道了')
+                  }
+                })
+              } else {
+                _this.$message.success(res.message)
+                _this.$refs.table.refresh(true)
+              }
+            }
+          })
+        }
+      })
+    },
     // 初始化
     // 初始化
     pageInit () {
     pageInit () {
       this.$nextTick(() => { // 页面渲染完成后的回调
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 79 - 19
src/views/setting/tireSubsidySetting/addSubsidyModal.vue

@@ -19,7 +19,7 @@
           :wrapper-col="formItemLayout.wrapperCol"
           :wrapper-col="formItemLayout.wrapperCol"
         >
         >
           <div class="formList" style="margin-bottom:15px;">
           <div class="formList" style="margin-bottom:15px;">
-            <a-radio-group id="addSubsidyModal-defaultFlag" v-model="form.defaultFlag">
+            <a-radio-group id="addSubsidyModal-defaultFlag" v-model="form.defaultFlag" @change="defaultChange">
               <a-radio :value="0" id="addSubsidyModal-defaultFlag0">
               <a-radio :value="0" id="addSubsidyModal-defaultFlag0">
                 指定客户
                 指定客户
               </a-radio>
               </a-radio>
@@ -40,7 +40,7 @@
                 :max="99999999"
                 :max="99999999"
                 id="addSubsidyModal-ruleTarget1"
                 id="addSubsidyModal-ruleTarget1"
                 :precision="0"
                 :precision="0"
-                placeholder="请输入"/>条,每条补贴
+                placeholder="请输入"/>条每条补贴
               <a-input-number
               <a-input-number
                 v-model="form.ruleValue1"
                 v-model="form.ruleValue1"
                 :min="0.01"
                 :min="0.01"
@@ -58,7 +58,7 @@
                 :max="99999999"
                 :max="99999999"
                 id="addSubsidyModal-ruleTarget2"
                 id="addSubsidyModal-ruleTarget2"
                 :precision="0"
                 :precision="0"
-                placeholder="请输入"/>条,每条补贴
+                placeholder="请输入"/>条每条补贴
               <a-input-number
               <a-input-number
                 v-model="form.ruleValue2"
                 v-model="form.ruleValue2"
                 :min="form.ruleValue1*1+0.01"
                 :min="form.ruleValue1*1+0.01"
@@ -76,7 +76,7 @@
                 :max="99999999"
                 :max="99999999"
                 id="addSubsidyModal-ruleTarget3"
                 id="addSubsidyModal-ruleTarget3"
                 :precision="0"
                 :precision="0"
-                placeholder="请输入"/>条,每条补贴
+                placeholder="请输入"/>条每条补贴
               <a-input-number
               <a-input-number
                 v-model="form.ruleValue3"
                 v-model="form.ruleValue3"
                 :min="form.ruleValue2*1+0.01"
                 :min="form.ruleValue2*1+0.01"
@@ -87,6 +87,16 @@
                 placeholder="请输入"/>元
                 placeholder="请输入"/>元
             </div>
             </div>
           </a-form-model-item>
           </a-form-model-item>
+          <div class="formList formBoxList" v-if="feeDataList&&feeDataList.length>0">
+            <div v-for="item in feeDataList" :key="item.id" style="display:flex;align-items:baseline;">
+              <span>{{ item.effectType==1?'当前':'次月' }}增量补贴({{ pageType==='SUBSIDY_QUARTER_FEE'?'季':'年' }}度):</span>
+              <div>
+                <p v-if="item.ruleTarget1">大于等于{{ item.ruleTarget1 }}条,每条补贴{{ item.ruleValue1 }}元</p>
+                <p v-if="item.ruleTarget2">大于等于{{ item.ruleTarget1 }}条,每条补贴{{ item.ruleValue2 }}元</p>
+                <p v-if="item.ruleTarget3">大于等于{{ item.ruleTarget1 }}条,每条补贴{{ item.ruleValue3 }}元</p>
+              </div>
+            </div>
+          </div>
         </a-form-model>
         </a-form-model>
         <div class="btn-cont">
         <div class="btn-cont">
           <a-button id="addSubsidyModal-cancel" @click="isShow = false" style="margin-right: 15px;">取消</a-button>
           <a-button id="addSubsidyModal-cancel" @click="isShow = false" style="margin-right: 15px;">取消</a-button>
@@ -102,7 +112,7 @@
 import { VSelect } from '@/components'
 import { VSelect } from '@/components'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 // 接口
 // 接口
-import { subsidyRuleSave, createSubsidyRule } from '@/api/subsidyRule'
+import { subsidyRuleSave, createSubsidyRule, getSubsidyRuleList } from '@/api/subsidyRule'
 export default {
 export default {
   name: 'AddSubsidyModal',
   name: 'AddSubsidyModal',
   components: { VSelect, dealerSubareaScopeList },
   components: { VSelect, dealerSubareaScopeList },
@@ -139,7 +149,8 @@ export default {
       rules: {
       rules: {
         dealerSn: [{ required: true, message: '请选择客户名称', trigger: 'change' }],
         dealerSn: [{ required: true, message: '请选择客户名称', trigger: 'change' }],
         ruleTarget1: [{ required: true, message: '增量补贴不能为空', trigger: 'blur' }]
         ruleTarget1: [{ required: true, message: '增量补贴不能为空', trigger: 'blur' }]
-      }
+      },
+      feeDataList: null
     }
     }
   },
   },
   methods: {
   methods: {
@@ -147,10 +158,32 @@ export default {
     custChange (val) {
     custChange (val) {
       if (val && val.key) {
       if (val && val.key) {
         this.form.dealerSn = val.key
         this.form.dealerSn = val.key
+        this.getHistoryData({ dealerSn: val.key, subsidyQueryStatus: 'NOT_FINISH', ruleType: this.pageType })
       } else {
       } else {
-        this.form.dealerSn = undefined
+        this.feeDataList = null
       }
       }
     },
     },
+    // 0指定客户  1默认客户  change
+    defaultChange (e) {
+      this.form.defaultFlag = e.target.value
+      if (e.target.value == '1') {
+        this.getHistoryData({ defaultFlag: 1, subsidyQueryStatus: 'NOT_FINISH', ruleType: this.pageType })
+      } else {
+        this.feeDataList = null
+      }
+    },
+    // 获取当月/次月  历史数据值
+    getHistoryData (ajaxData) {
+      this.spinning = true
+      getSubsidyRuleList(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.feeDataList = res.data
+        } else {
+          this.feeDataList = null
+        }
+        this.spinning = false
+      })
+    },
     // 保存
     // 保存
     handleSave () {
     handleSave () {
       const _this = this
       const _this = this
@@ -160,20 +193,20 @@ export default {
           const newForm = JSON.parse(JSON.stringify(_this.form))
           const newForm = JSON.parse(JSON.stringify(_this.form))
           delete newForm.defaultFlag
           delete newForm.defaultFlag
           delete newForm.dealerSn
           delete newForm.dealerSn
-          const flagArr = []
-          for (const i in newForm) { flagArr.push(newForm[i]) }
-          if (flagArr && flagArr.length < 6) {
-            _this.$message.error('增量补贴不能为空!')
+          const flag = _this.isValid(newForm)
+          if (!flag) {
+            _this.$message.error('季度增量补贴【条数】与【补贴】不能为空!')
             return
             return
           }
           }
+
           _this.form.ruleType = _this.pageType
           _this.form.ruleType = _this.pageType
           _this.spinning = true
           _this.spinning = true
-          subsidyRuleSave(this.form).then(res => {
+          subsidyRuleSave(_this.form).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               if (!res.data) {
               if (!res.data) {
-                this.isShow = false
-                this.$message.success(res.message)
-                this.$emit('ok')
+                _this.isShow = false
+                _this.$message.success(res.message)
+                _this.$emit('ok')
               } else {
               } else {
                 _this.openTip(res.data)
                 _this.openTip(res.data)
               }
               }
@@ -186,12 +219,31 @@ export default {
         }
         }
       })
       })
     },
     },
+    // 为空判断
+    isValid (obj) {
+      // 检查阶梯1是否有值
+      const hasStep1 = obj.ruleTarget1 && obj.ruleValue1
+      // 检查阶梯2是否有值
+      const hasStep2 = obj.ruleTarget2 && obj.ruleValue2
+      // 检查阶梯3是否有值
+      const hasStep3 = obj.ruleTarget3 && obj.ruleValue3
+      // 情况1: 阶梯1必须有值
+      if (!hasStep1) {
+        return false
+      }
+      // 情况2: 如果阶梯3有值,阶梯1和阶梯2都不能为空
+      if (hasStep3 && (!hasStep1 || !hasStep2)) {
+        return false
+      }
+      // 如果以上条件都满足,返回true
+      return true
+    },
     openTip (code) {
     openTip (code) {
       const _this = this
       const _this = this
-      if (code === 'IN_USE') {
+      if (code === 'WAIT') {
         this.$confirm({
         this.$confirm({
           title: '提示',
           title: '提示',
-          content: '将重新生成新的运费补贴,并结束当前运费补贴。',
+          content: '将重新生成新的' + (_this.pageType === 'SUBSIDY_QUARTER_FEE' ? '季' : '年') + '度补贴,并结束当前' + (_this.pageType === 'SUBSIDY_QUARTER_FEE' ? '季' : '年') + '度增量补贴。',
           centered: true,
           centered: true,
           onOk () {
           onOk () {
             createSubsidyRule(_this.form).then(res => {
             createSubsidyRule(_this.form).then(res => {
@@ -206,7 +258,7 @@ export default {
       } else {
       } else {
         this.$confirm({
         this.$confirm({
           title: '提示',
           title: '提示',
-          content: '已存在【未开始】的运费补贴',
+          content: '已存在【启用中】的' + (_this.pageType === 'SUBSIDY_QUARTER_FEE' ? '季' : '年') + '度增量补贴',
           centered: true,
           centered: true,
           okText: '知道了',
           okText: '知道了',
           cancelButtonProps: {
           cancelButtonProps: {
@@ -230,7 +282,10 @@ export default {
       this.form.ruleValue2 = undefined
       this.form.ruleValue2 = undefined
       this.form.ruleTarget3 = undefined
       this.form.ruleTarget3 = undefined
       this.form.ruleValue3 = undefined
       this.form.ruleValue3 = undefined
-      this.$refs.dealerSubareaScopeList.resetForm()
+      if (this.form.defaultFlag == 0) {
+        this.$refs.dealerSubareaScopeList.resetForm()
+      }
+      this.feeDataList = null
       this.$refs.ruleForm.resetFields()
       this.$refs.ruleForm.resetFields()
     }
     }
   },
   },
@@ -255,6 +310,11 @@ export default {
     .formList{
     .formList{
       margin-left:60px;
       margin-left:60px;
     }
     }
+    .formBoxList{
+      div:last-child{
+        margin-top:10px;
+      }
+    }
     .ant-modal-body {
     .ant-modal-body {
       padding: 40px 40px 24px;
       padding: 40px 40px 24px;
     }
     }

+ 37 - 20
src/views/setting/tireSubsidySetting/costAddModal.vue

@@ -19,7 +19,7 @@
           :wrapper-col="formItemLayout.wrapperCol"
           :wrapper-col="formItemLayout.wrapperCol"
         >
         >
           <div class="formList" style="margin-bottom:15px;">
           <div class="formList" style="margin-bottom:15px;">
-            <a-radio-group id="costAddModal-defaultFlag" v-model="form.defaultFlag">
+            <a-radio-group id="costAddModal-defaultFlag" v-model="form.defaultFlag" @change="defaultChange">
               <a-radio :value="0" id="costAddModal-defaultFlag0">
               <a-radio :value="0" id="costAddModal-defaultFlag0">
                 指定客户
                 指定客户
               </a-radio>
               </a-radio>
@@ -35,9 +35,9 @@
             <a-input-number
             <a-input-number
               id="costAddModal-ruleValue1"
               id="costAddModal-ruleValue1"
               v-model="form.ruleValue1"
               v-model="form.ruleValue1"
-              :min="1"
+              :min="0.01"
               style="width:90%;"
               style="width:90%;"
-              :max="99999999"
+              :max="pageType==='SERVICE_FEE'?100:99999999"
               :precision="2"
               :precision="2"
               :placeholder="'请输入'+(pageType==='SERVICE_FEE'?'服务费比例':'运费补贴')"/>
               :placeholder="'请输入'+(pageType==='SERVICE_FEE'?'服务费比例':'运费补贴')"/>
             <span style="margin-left:10px;">{{ pageType==='SERVICE_FEE'?'%':'元' }}</span>
             <span style="margin-left:10px;">{{ pageType==='SERVICE_FEE'?'%':'元' }}</span>
@@ -52,8 +52,8 @@
               </a-radio>
               </a-radio>
             </a-radio-group>
             </a-radio-group>
           </a-form-model-item>
           </a-form-model-item>
-          <div class="formList" v-if="(pageType==='SERVICE_FEE' || pageType==='SHIPPING_FEE')&&feeDataList&&feeDataList.length>0">
-            <div v-for="item in feeDataList" :key="item.id">{{ item.effectType==1?'当前':'次月' }}{{ pageType==='SERVICE_FEE'?'服务费比例':'运费补贴' }}:{{ item.ruleValue1 }}%</div>
+          <div class="formList formBoxList" v-if="feeDataList&&feeDataList.length>0">
+            <div v-for="item in feeDataList" :key="item.id">{{ item.effectType==1?'当前':'次月' }}{{ pageType==='SERVICE_FEE'?'服务费比例':'运费补贴' }}:{{ item.ruleValue1 }}{{ pageType==='SERVICE_FEE'?'%':'元' }}</div>
           </div>
           </div>
         </a-form-model>
         </a-form-model>
         <div class="btn-cont">
         <div class="btn-cont">
@@ -114,19 +114,32 @@ export default {
     custChange (val) {
     custChange (val) {
       if (val && val.key) {
       if (val && val.key) {
         this.form.dealerSn = val.key
         this.form.dealerSn = val.key
-        this.spinning = true
-        getSubsidyRuleList({ dealerSn: val.key, subsidyQueryStatus: 'NOT_FINISH', ruleType: this.pageType }).then(res => {
-          if (res.status == 200) {
-            this.feeDataList = res.data
-          } else {
-            this.feeDataList = null
-          }
-          this.spinning = false
-        })
+        this.getHistoryData({ dealerSn: val.key, subsidyQueryStatus: 'NOT_FINISH', ruleType: this.pageType })
       } else {
       } else {
         this.feeDataList = null
         this.feeDataList = null
       }
       }
     },
     },
+    // 0指定客户  1默认客户  change
+    defaultChange (e) {
+      this.form.defaultChange = e.target.value
+      if (e.target.value == '1') {
+        this.getHistoryData({ defaultFlag: 1, subsidyQueryStatus: 'NOT_FINISH', ruleType: this.pageType })
+      } else {
+        this.feeDataList = null
+      }
+    },
+    // 获取当月/次月  历史数据值
+    getHistoryData (ajaxData) {
+      this.spinning = true
+      getSubsidyRuleList(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.feeDataList = res.data
+        } else {
+          this.feeDataList = null
+        }
+        this.spinning = false
+      })
+    },
     // 保存
     // 保存
     handleSave () {
     handleSave () {
       const _this = this
       const _this = this
@@ -157,7 +170,7 @@ export default {
       if (code === 'IN_USE') {
       if (code === 'IN_USE') {
         this.$confirm({
         this.$confirm({
           title: '提示',
           title: '提示',
-          content: '将重新生成新的运费补贴,并结束当前运费补贴。',
+          content: '将重新生成新的' + (_this.pageType === 'SERVICE_FEE' ? '服务费比例' : '运费补贴') + ',并结束当前' + (_this.pageType === 'SERVICE_FEE' ? '服务费比例。' : '运费补贴。'),
           centered: true,
           centered: true,
           onOk () {
           onOk () {
             createSubsidyRule(_this.form).then(res => {
             createSubsidyRule(_this.form).then(res => {
@@ -172,7 +185,7 @@ export default {
       } else {
       } else {
         this.$confirm({
         this.$confirm({
           title: '提示',
           title: '提示',
-          content: '已存在【未开始】的运费补贴',
+          content: '已存在【未开始】的' + (_this.pageType === 'SERVICE_FEE' ? '服务费比例' : '运费补贴'),
           centered: true,
           centered: true,
           okText: '知道了',
           okText: '知道了',
           cancelButtonProps: {
           cancelButtonProps: {
@@ -193,7 +206,9 @@ export default {
       this.form.ruleValue1 = undefined
       this.form.ruleValue1 = undefined
       this.form.ruleType = undefined
       this.form.ruleType = undefined
       this.form.effectType = undefined
       this.form.effectType = undefined
-      this.$refs.dealerSubareaScopeList.resetForm()
+      if (this.form.defaultFlag == 0) {
+        this.$refs.dealerSubareaScopeList.resetForm()
+      }
       this.feeDataList = null
       this.feeDataList = null
       this.$refs.ruleForm.resetFields()
       this.$refs.ruleForm.resetFields()
     }
     }
@@ -218,9 +233,11 @@ export default {
   .costAdd-modal{
   .costAdd-modal{
     .formList{
     .formList{
       margin-left:42px;
       margin-left:42px;
-      // div:last-child{
-      //   margin-bottom:20px;
-      // }
+    }
+    .formBoxList{
+      div:last-child{
+        margin-top:10px;
+      }
     }
     }
     .ant-modal-body {
     .ant-modal-body {
       padding: 40px 40px 24px;
       padding: 40px 40px 24px;

+ 49 - 29
src/views/setting/tireSubsidySetting/costCollectionList.vue

@@ -73,6 +73,10 @@
           <template slot="customName" slot-scope="text, record">
           <template slot="customName" slot-scope="text, record">
             {{ record.dealerEntity&&record.dealerEntity.dealerName?record.dealerEntity.dealerName:record.defaultFlag==1?'默认':'--' }}
             {{ record.dealerEntity&&record.dealerEntity.dealerName?record.dealerEntity.dealerName:record.defaultFlag==1?'默认':'--' }}
           </template>
           </template>
+          <!-- 结束时间 -->
+          <template slot="endDate" slot-scope="text, record">
+            {{ record.status==='END'? record.ruleEndDate:'--' }}
+          </template>
           <!-- 操作 -->
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
           <template slot="action" slot-scope="text, record">
             <a-button
             <a-button
@@ -113,7 +117,13 @@
     <!-- 新增 -->
     <!-- 新增 -->
     <cost-add-modal v-drag :openModal="openCostAddModal" :pageType="pageType" @ok="$refs.table.refresh(true)" @close="openCostAddModal = false" />
     <cost-add-modal v-drag :openModal="openCostAddModal" :pageType="pageType" @ok="$refs.table.refresh(true)" @close="openCostAddModal = false" />
     <!-- 编辑 -->
     <!-- 编辑 -->
-    <edit-modal></edit-modal>
+    <edit-modal
+      v-drag
+      :openModal="openCostEditModal"
+      ref="costEditModal"
+      :pageType="pageType"
+      @ok="$refs.table.refresh(true)"
+      @close="openCostEditModal = false" ></edit-modal>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -124,13 +134,14 @@ import { STable, VSelect } from '@/components'
 import subarea from '@/views/common/subarea.js'
 import subarea from '@/views/common/subarea.js'
 import AreaList from '@/views/common/areaList.js'
 import AreaList from '@/views/common/areaList.js'
 import costAddModal from './costAddModal.vue'
 import costAddModal from './costAddModal.vue'
+import editModal from './editModal.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 // 接口
 // 接口
 import { tireSubsidyRuleList, delSubsidyRule, endSubsidyRule } from '@/api/subsidyRule'
 import { tireSubsidyRuleList, delSubsidyRule, endSubsidyRule } from '@/api/subsidyRule'
 export default {
 export default {
   name: 'CostCollectionList',
   name: 'CostCollectionList',
   mixins: [commonMixin],
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, costAddModal },
+  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, costAddModal, editModal },
   props: {
   props: {
     pageType: { //  弹框显示状态
     pageType: { //  弹框显示状态
       type: String,
       type: String,
@@ -144,6 +155,7 @@ export default {
       advanced: true, // 高级搜索 展开/关闭
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0, // 表格高度
       tableHeight: 0, // 表格高度
       openCostAddModal: false, // 新增弹窗
       openCostAddModal: false, // 新增弹窗
+      openCostEditModal: false, // 编辑弹窗
       exportLoading: false, // 导出按钮加载状态
       exportLoading: false, // 导出按钮加载状态
       showExport: false, // 导出弹窗
       showExport: false, // 导出弹窗
       timeInfo: [], // 日期
       timeInfo: [], // 日期
@@ -153,15 +165,13 @@ export default {
           subareaSn: '', // 区域
           subareaSn: '', // 区域
           subareaAreaSn: '' // 分区
           subareaAreaSn: '' // 分区
         },
         },
-        customSn: undefined, // 客户sn
-        dealerEntity: {
-          dealerName: undefined, // 客户名称
-          provinceSn: undefined, // 省
-          citySn: undefined, // 市
-          districtSn: undefined // 区
-        },
-        ruleType: undefined,
-        subsidyQueryStatus: 'NOT_FINISH'
+        dealerSn: undefined, // 客户sn
+        dealerName: undefined, // 客户名称
+        provinceSn: undefined, // 省
+        citySn: undefined, // 市
+        districtSn: undefined, // 区
+        ruleType: undefined,//页面类型
+        subsidyQueryStatus: 'NOT_FINISH'//状态默认值
       },
       },
       totalData: null, // 合计
       totalData: null, // 合计
       rules: {
       rules: {
@@ -201,14 +211,14 @@ export default {
       const _this = this
       const _this = this
       const arr = [
       const arr = [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '区域', dataIndex: 'subareaArea.subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '区域', dataIndex: 'subareaArea.subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '14%', align: 'center', scopedSlots: { customRender: 'customName' }, ellipsis: true },
         { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '14%', align: 'center', scopedSlots: { customRender: 'customName' }, ellipsis: true },
         { title: '开始时间', dataIndex: 'ruleStartDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '开始时间', dataIndex: 'ruleStartDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '结束时间', dataIndex: 'ruleEndDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '结束时间', dataIndex: 'ruleEndDate', width: '14%', align: 'center', scopedSlots: { customRender: 'endDate' } },
         { title: '状态', dataIndex: 'statusDictValue', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '状态', dataIndex: 'statusDictValue', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
       ]
       if (this.pageType === 'SERVICE_FEE') {
       if (this.pageType === 'SERVICE_FEE') {
         arr.splice(7, 0, { title: '服务费比例(%)', dataIndex: 'ruleValue1', width: '14%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         arr.splice(7, 0, { title: '服务费比例(%)', dataIndex: 'ruleValue1', width: '14%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
@@ -225,14 +235,14 @@ export default {
     },
     },
     // 客户名称 change
     // 客户名称 change
     custChange (val) {
     custChange (val) {
-      this.queryParam.dealerEntity.dealerName = val.name
-      this.queryParam.customSn = val.key
+      this.queryParam.dealerName = val.name
+      this.queryParam.dealerSn = val.key
     },
     },
     // 地区
     // 地区
     areaChange (val) {
     areaChange (val) {
-      this.queryParam.dealerEntity.provinceSn = val[0] ? val[0] : undefined
-      this.queryParam.dealerEntity.citySn = val[1] ? val[1] : undefined
-      this.queryParam.dealerEntity.districtSn = val[2] ? val[2] : undefined
+      this.queryParam.provinceSn = val[0] ? val[0] : undefined
+      this.queryParam.citySn = val[1] ? val[1] : undefined
+      this.queryParam.districtSn = val[2] ? val[2] : undefined
     },
     },
     // 区域分区  change
     // 区域分区  change
     subareaChange (val) {
     subareaChange (val) {
@@ -241,11 +251,11 @@ export default {
     },
     },
     //  重置
     //  重置
     resetSearchForm () {
     resetSearchForm () {
-      this.queryParam.dealerEntity.provinceSn = undefined
-      this.queryParam.dealerEntity.citySn = undefined
-      this.queryParam.dealerEntity.districtSn = undefined
-      this.queryParam.dealerEntity.dealerName = undefined
-      this.queryParam.customSn = undefined
+      this.queryParam.provinceSn = undefined
+      this.queryParam.citySn = undefined
+      this.queryParam.districtSn = undefined
+      this.queryParam.dealerName = undefined
+      this.queryParam.dealerSn = undefined
       this.queryParam.ruleType = undefined
       this.queryParam.ruleType = undefined
       this.queryParam.subareaArea.subareaSn = ''
       this.queryParam.subareaArea.subareaSn = ''
       this.queryParam.subareaArea.subareaAreaSn = ''
       this.queryParam.subareaArea.subareaAreaSn = ''
@@ -257,6 +267,15 @@ export default {
     },
     },
     // 编辑
     // 编辑
     handleEdit (row) {
     handleEdit (row) {
+      const sendData = {
+        dealerName: row.dealerEntity && row.dealerEntity.dealerName ? row.dealerEntity.dealerName : undefined,
+        ruleStartDate: row.ruleStartDate,
+        ruleValue1: row.ruleValue1,
+        defaultFlag: row.defaultFlag,
+        ruleSn: row.ruleSn
+      }
+      this.$refs.costEditModal.getFormData(sendData)
+      this.openCostEditModal = true
     },
     },
     // 结束  删除
     // 结束  删除
     handleEndOrDel (row, type) {
     handleEndOrDel (row, type) {
@@ -265,17 +284,18 @@ export default {
       if (this.pageType === 'SERVICE_FEE') {
       if (this.pageType === 'SERVICE_FEE') {
         tipWord = type === 'end' ? '确定结束服务费比例吗?结束后以默认服务费比例计算' : '确定删除服务费比例吗?'
         tipWord = type === 'end' ? '确定结束服务费比例吗?结束后以默认服务费比例计算' : '确定删除服务费比例吗?'
       } else {
       } else {
-        tipWord = type === 'end' ? '确定结束运费补贴吗?结束后以默认运费补贴计算' : '确定删除运费补贴吗?删除后次月以默认运费补贴计算'
+        tipWord = type === 'end' ? '确定结束运费补贴吗?结束后以默认运费补贴计算' : '确定删除运费补贴吗?'
       }
       }
-      this.$confirm({
+      const _this = this
+      _this.$confirm({
         title: '提示',
         title: '提示',
         content: tipWord,
         content: tipWord,
         centered: true,
         centered: true,
         onOk () {
         onOk () {
-          ajaxName({ ruleSn: row.ruleSn, ruleType: this.pageType }).then(res => {
+          ajaxName({ ruleSn: row.ruleSn, ruleType: _this.pageType }).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
-              this.$message.success(res.message)
-              this.$refs.table.refresh(true)
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh(true)
             }
             }
           })
           })
         }
         }

+ 272 - 0
src/views/setting/tireSubsidySetting/editModal.vue

@@ -0,0 +1,272 @@
+<template>
+  <a-modal
+    centered
+    class="editTireSetting-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="编辑"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="700">
+    <div>
+      <a-spin :spinning="spinning" tip="Loading...">
+        <a-form-model
+          id="editTireSettingModal-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+          :label-col="formItemLayout.labelCol"
+          :wrapper-col="formItemLayout.wrapperCol"
+        >
+          <a-form-model-item label="客户名称" v-if="form.defaultFlag==0">
+            {{ form.dealerName||'--' }}
+          </a-form-model-item>
+          <div v-if="pageType==='SERVICE_FEE' || pageType==='SHIPPING_FEE'">
+            <a-form-model-item label="开始时间">
+              {{ form.ruleStartDate||'--' }}
+            </a-form-model-item>
+            <a-form-model-item :label="pageType==='SERVICE_FEE'?'服务费比例':'运费补贴'" prop="ruleValue1">
+              <a-input-number
+                id="editTireSettingModal-ruleValue1"
+                v-model="form.ruleValue1"
+                :min="0.01"
+                style="width:90%;"
+                :max="pageType==='SERVICE_FEE'?100:99999999"
+                :precision="2"
+                :placeholder="'请输入'+(pageType==='SERVICE_FEE'?'服务费比例':'运费补贴')"/>
+              <span style="margin-left:10px;">{{ pageType==='SERVICE_FEE'?'%':'元' }}</span>
+            </a-form-model-item>
+          </div>
+          <div v-else>
+            <a-form-model-item label="增量补贴(季度)" prop="ruleTarget1">
+              <div>
+                大于等于<a-input-number
+                  v-model="form.ruleTarget1"
+                  :min="1"
+                  style="width:80px;margin:0 6px;"
+                  :max="99999999"
+                  id="addSubsidyModal-ruleTarget1"
+                  :precision="0"
+                  placeholder="请输入"/>条,每条补贴
+                <a-input-number
+                  v-model="form.ruleValue1"
+                  :min="0.01"
+                  id="addSubsidyModal-ruleValue1"
+                  style="width:80px;margin:0 6px;"
+                  :max="99999999"
+                  :precision="2"
+                  placeholder="请输入"/>元
+              </div>
+              <div>
+                大于等于<a-input-number
+                  v-model="form.ruleTarget2"
+                  :min="form.ruleTarget1*1+1"
+                  style="width:80px;margin:0 6px;"
+                  :max="99999999"
+                  id="addSubsidyModal-ruleTarget2"
+                  :precision="0"
+                  placeholder="请输入"/>条,每条补贴
+                <a-input-number
+                  v-model="form.ruleValue2"
+                  :min="form.ruleValue1*1+0.01"
+                  id="addSubsidyModal-ruleValue2"
+                  style="width:80px;margin:0 6px;"
+                  :max="99999999"
+                  :precision="2"
+                  placeholder="请输入"/>元
+              </div>
+              <div>
+                大于等于<a-input-number
+                  v-model="form.ruleTarget3"
+                  :min="form.ruleTarget2*1+1"
+                  style="width:80px;margin:0 6px;"
+                  :max="99999999"
+                  id="addSubsidyModal-ruleTarget3"
+                  :precision="0"
+                  placeholder="请输入"/>条,每条补贴
+                <a-input-number
+                  v-model="form.ruleValue3"
+                  :min="form.ruleValue2*1+0.01"
+                  id="addSubsidyModal-ruleValue3"
+                  style="width:80px;margin:0 6px;"
+                  :max="99999999"
+                  :precision="2"
+                  placeholder="请输入"/>元
+              </div>
+            </a-form-model-item>
+          </div>
+        </a-form-model>
+        <div class="btn-cont">
+          <a-button id="editTireSettingModal-cancel" @click="isShow = false" style="margin-right: 15px;">取消</a-button>
+          <a-button type="primary" id="editTireSettingModal-save" @click="handleSave">保存</a-button>
+        </div>
+      </a-spin>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+// 接口
+import { editSubsidyRule } from '@/api/subsidyRule'
+export default {
+  name: 'EditTireSettingModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    pageType: { //  页面类型
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false, // 页面加载状态
+      formItemLayout: {// form表单中label设置
+        labelCol: { span: 5 },
+        wrapperCol: { span: 17 }
+      },
+      // 提交数据
+      form: {
+        ruleSn: undefined,
+        defaultFlag: 0,
+        dealerName: undefined,
+        ruleStartDate: undefined,
+        ruleTarget1: undefined,
+        ruleValue1: undefined,
+        ruleTarget2: undefined,
+        ruleValue2: undefined,
+        ruleTarget3: undefined,
+        ruleValue3: undefined
+      },
+      // 必填项判断
+      rules: {
+        ruleValue1: [{ required: true, message: '请输入服务费比例', trigger: 'blur' }],
+        ruleTarget1: [{ required: true, message: '增量补贴不能为空', trigger: 'blur' }]
+      }
+    }
+  },
+  methods: {
+    // 保存
+    handleSave () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          // 为空判断
+          if (_this.pageType === 'SUBSIDY_QUARTER_FEE' || _this.pageType === 'SUBSIDY_YEAR_FEE') {
+            const newForm = JSON.parse(JSON.stringify(_this.form))
+            delete newForm.ruleSn
+            delete newForm.defaultFlag
+            delete newForm.dealerName
+            delete newForm.ruleStartDate
+            const flag = _this.isValid(newForm)
+            if (!flag) {
+              _this.$message.error('季度增量补贴【条数】与【补贴】不能为空!')
+              return
+            }
+          }
+          _this.form.ruleType = _this.pageType
+          _this.spinning = true
+          editSubsidyRule(this.form).then(res => {
+            if (res.status == 200) {
+              if (!res.data) {
+                _this.isShow = false
+                _this.$message.success(res.message)
+                _this.$emit('ok')
+              } else {
+                _this.openTip(res.data)
+              }
+            }
+            _this.spinning = false
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 为空判断
+    isValid (obj) {
+      // 检查阶梯1是否有值
+      const hasStep1 = obj.ruleTarget1 && obj.ruleValue1
+      // 检查阶梯2是否有值
+      const hasStep2 = obj.ruleTarget2 && obj.ruleValue2
+      // 检查阶梯3是否有值
+      const hasStep3 = obj.ruleTarget3 && obj.ruleValue3
+      // 情况1: 阶梯1必须有值
+      if (!hasStep1) {
+        return false
+      }
+      // 情况2: 如果阶梯3有值,阶梯1和阶梯2都不能为空
+      if (hasStep3 && (!hasStep1 || !hasStep2)) {
+        return false
+      }
+      // 如果以上条件都满足,返回true
+      return true
+    },
+    // 错误提示语
+    openTip (code) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '当前规则不可操作,请刷新后重试',
+        centered: true,
+        okText: '知道了',
+        cancelButtonProps: {
+          style: {
+            display: 'none' // 通过设置样式隐藏取消按钮
+          }
+        },
+        onOk () {
+          console.log('知道了')
+        }
+      })
+    },
+    // 重置
+    resetFormData () {
+      this.form.defaultFlag = 0
+      this.form.ruleSn = undefined
+      this.form.dealerName = undefined
+      this.form.ruleStartDate = undefined
+      this.form.ruleTarget1 = undefined
+      this.form.ruleValue1 = undefined
+      this.form.ruleTarget2 = undefined
+      this.form.ruleValue2 = undefined
+      this.form.ruleTarget3 = undefined
+      this.form.ruleValue3 = undefined
+      this.$refs.ruleForm.resetFields()
+    },
+    // 获取编辑数据
+    getFormData (getData) {
+      this.form = getData
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetFormData()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .editTireSetting-modal{
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 30px;
+    }
+  }
+</style>