浏览代码

修改商户计费配置

luogang 11 月之前
父节点
当前提交
1c51762db4
共有 2 个文件被更改,包括 215 次插入6 次删除
  1. 28 0
      ems-ui/src/api/basecfg/elecAttr.js
  2. 187 6
      ems-ui/src/views/basecfg/price/index.vue

+ 28 - 0
ems-ui/src/api/basecfg/elecAttr.js

@@ -70,3 +70,31 @@ export function delStrategy(id) {
     method: 'delete'
   })
 }
+//商户计费配置
+export function addCharging(data) {
+  return request({
+    url: '/ems/basecfg/elecPrice/coCharging',
+    method: 'post',
+    data: data
+  })
+}
+export function listCharging(params) {
+  return request({
+    url: '/ems/basecfg/elecPrice/coCharging/list',
+    method: 'get',
+    params
+  })
+}
+export function updateCharging(data) {
+  return request({
+    url: '/ems/basecfg/elecPrice/coCharging',
+    method: 'put',
+    data: data
+  })
+}
+export function delCharging(id) {
+  return request({
+    url: '/ems/basecfg/elecPrice/coCharging/' + id,
+    method: 'delete'
+  })
+}

+ 187 - 6
ems-ui/src/views/basecfg/price/index.vue

@@ -292,6 +292,84 @@
           </div>
         </el-dialog>
       </el-tab-pane>
+      <el-tab-pane label="商户计费配置" name="five">
+        <!-- 商户计费配置 -->
+        <!-- <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleChargingAdd" v-hasPermi="['basecfg:price:add']">新增
+            </el-button>
+          </el-col>
+          <right-toolbar :showSearch.sync="showSearch" :search="false" @queryTable="getChargingList"></right-toolbar>
+        </el-row> -->
+        <el-table v-loading="chargingParams.loading" :data="chargingList">
+          <el-table-column label="服务区名称" align="center" prop="areaName" />
+          <el-table-column label="电计量单价" align="center" prop="elecUnitPrice" />
+          <el-table-column label="电公摊计算类型" align="center">
+            <template slot-scope="scope">
+              {{formatDict(scope.row.elecGtComputeType,'computeTypeOptions')}}
+            </template>
+          </el-table-column>
+          <el-table-column label="电费计算说明" align="center" prop="elecComputeDesc" show-overflow-tooltip />
+          <el-table-column label="水计量单价" align="center" prop="waterUnitPrice" />
+          <el-table-column label="水公摊计量类型" align="center">
+            <template slot-scope="scope">
+              {{formatDict(scope.row.waterGtComputeType,'computeTypeOptions')}}
+            </template>
+          </el-table-column>
+          <el-table-column label="水费说明" align="center" prop="waterComputeDesc" show-overflow-tooltip />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleChargingUpdate(scope.row)"
+                v-hasPermi="['basecfg:price:edit']">修改</el-button>
+              <!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleChargingDelete(scope.row)"
+                v-hasPermi="['basecfg:price:del']">删除</el-button> -->
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <!-- 添加或修改对话框 -->
+        <el-dialog :title="title" :visible.sync="chargingDialog" custom-class="custom-dialog" width="650px" append-to-body>
+          <el-form ref="chargingForm" :model="chargingForm" label-width="120px">
+            <el-form-item label="服务区名称" prop="areaCode" required :rules="[{required:true,message:'请选择服务区名称'}]">
+              <el-select v-model="chargingForm.areaCode" disabled style="width:100%">
+                <el-option v-for="item in areaOptions" :label="item.label" :value="item.id" :key="item.id" />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="电计量单价" prop="elecUnitPrice" required :rules="[{required:true,message:'电计量单价不能为空'}]">
+              <el-input v-model="chargingForm.elecUnitPrice" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="请输入电计量单价" />
+            </el-form-item>
+            <el-form-item label="电公摊计算类型" prop="elecGtComputeType" required :rules="[{required:true,message:'请选择电公摊计算类型'}]">
+              <el-select v-model="chargingForm.elecGtComputeType" style="width:100%">
+                <el-option v-for="item in computeTypeOptions" :label="item.name" :value="item.value" :key="item.value" />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="电费计算说明" prop="elecComputeDesc">
+              <el-input v-model="chargingForm.elecComputeDesc" placeholder="请输入电费计算说明" />
+            </el-form-item>
+            <el-form-item label="水计量单价" prop="waterUnitPrice" required :rules="[{required:true,message:'水计量单价不能为空'}]">
+              <el-input v-model="chargingForm.waterUnitPrice" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="请输入水计量单价" />
+            </el-form-item>
+            <el-form-item label="水公摊计算类型" prop="waterGtComputeType" required :rules="[{required:true,message:'请选择水公摊计算类型'}]">
+              <el-select v-model="chargingForm.waterGtComputeType" style="width:100%">
+                <el-option v-for="item in computeTypeOptions" :label="item.name" :value="item.value" :key="item.value" />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="水费说明" prop="waterComputeDesc">
+              <el-input v-model="chargingForm.waterComputeDesc" placeholder="请输入水费说明" />
+            </el-form-item>
+            <el-form-item label="关联商户" prop="waterComputeDesc">
+              <el-checkbox-group v-model="chargingForm.relCoList" class="custom-checkbox-group">
+                <el-checkbox v-for="item in zoningList" :key="item.zoningCode" :label="item.zoningCode">{{item.zoningName}}</el-checkbox>
+              </el-checkbox-group>
+            </el-form-item>
+
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button type="primary" @click="submitChargingForm">确 定</el-button>
+            <el-button @click="chargingCancel">取 消</el-button>
+          </div>
+        </el-dialog>
+      </el-tab-pane>
     </el-tabs>
 
   </div>
@@ -307,7 +385,11 @@ import {
   listStrategy,
   addStrategy,
   updateStrategy,
-  delStrategy
+  delStrategy,
+  listCharging,
+  updateCharging,
+  addCharging,
+  delCharging
 } from '@/api/basecfg/elecAttr'
 import {
   listGwPriceConfig,
@@ -320,6 +402,7 @@ import {
 import { addPvPriceConfig, delPvPriceConfig, getPvPriceConfig, listPvPriceConfig, updatePvPriceConfig } from '@/api/basecfg/elecPvPrice'
 import { getElecPriceType } from '@/api/commonApi'
 import { areaTreeSelect } from '@/api/basecfg/area'
+import { listZoning } from '@/api/basecfg/zoning'
 
 export default {
   name: 'Attr',
@@ -346,6 +429,8 @@ export default {
       pvPriceList: [],
       // 峰谷电价
       strategyList: [],
+      // 商户计费
+      chargingList: [],
       // 弹出层标题
       title: '',
       // 是否显示弹出层
@@ -353,6 +438,7 @@ export default {
       gwPriceCfgOpen: false,
       pvPriceOpen: false,
       strategyDialog: false,
+      chargingDialog: false,
       // 选项定义
       priceTypeOptions: undefined,
       areaOptions: undefined,
@@ -375,6 +461,11 @@ export default {
         pageNum: 1,
         pageSize: 10
       },
+      chargingParams: {
+        loading: false,
+        pageNum: 1,
+        pageSize: 10
+      },
       // 表单参数
       attrForm: {},
       gwPriceForm: {},
@@ -425,15 +516,34 @@ export default {
         repeatParam: [],
         priority: 0,
         hourList: []
-      }
+      },
+      computeTypeOptions: [
+        { name: '不计入', value: 0 },
+        { name: '户数均摊', value: 1 },
+        { name: '面积均摊', value: 2 }
+      ],
+      chargingForm: {
+        areaCode: '',
+        elecUnitPrice: '',
+        elecGtComputeType: '',
+        elecComputeDesc: '',
+        waterUnitPrice: '',
+        waterGtComputeType: '',
+        waterComputeDesc: '',
+        relCoList: []
+      },
+      zoningList: []
     }
   },
   created() {
+    this.getAreaList('Area')
     this.getAttrList()
     this.getGwPriceList()
     this.getPvPriceList()
     this.getPriceType()
     this.getStrategyList()
+    this.getChargingList()
+    this.getRelateShopList()
   },
   methods: {
     formatDict(value, options, key = 'value', name = 'name') {
@@ -571,7 +681,6 @@ export default {
     /** 新增按钮操作 */
     handleAttrAdd() {
       this.attrReset()
-      this.getAreaList('Area')
       this.getGwPriceAll()
       this.attrOpen = true
       this.title = '添加服务区用电属性'
@@ -579,7 +688,6 @@ export default {
     /** 修改按钮操作 */
     handleAttrUpdate(row) {
       this.attrReset()
-      this.getAreaList('Area')
       this.getGwPriceAll()
       const id = row.id || this.ids
       getAttr(id).then(response => {
@@ -764,7 +872,6 @@ export default {
       this.strategyDialog = false
       this.resetForm('strategyForm')
       this.strategyForm = this.$options.data().strategyForm
-
     },
     submitStrategyForm() {
       this.$refs['strategyForm'].validate(valid => {
@@ -820,7 +927,6 @@ export default {
         }
       })
     },
-
     compareTime(t1, t2) {
       const d = new Date()
       const ft1 = d.setHours(t1.split(':')[0], t1.split(':')[1], t1.split(':')[2])
@@ -854,6 +960,70 @@ export default {
     },
     deleteSub(index) {
       this.strategyForm.hourList.splice(index, 1)
+    },
+    /** 查询商户计费列表 */
+    getChargingList() {
+      const { pageNum, pageSize } = this.chargingParams
+      this.chargingParams.loading = true
+      listCharging({ pageNum, pageSize }).then(response => {
+        this.chargingList = response.rows
+        this.chargingParams.loading = false
+      })
+    },
+    getRelateShopList(areaCode) {
+      listZoning({
+        areaCode,
+        tagCodeList: ['Area_01']
+      }).then(({ rows }) => {
+        this.zoningList = rows
+      })
+    },
+    handleChargingAdd() {
+      this.resetForm('chargingForm')
+      this.chargingForm = this.$options.data().chargingForm
+      this.chargingDialog = true
+      this.title = '添加商户计费配置'
+    },
+    handleChargingUpdate(row) {
+      this.resetForm('chargingForm')
+      Object.assign(this.chargingForm, row)
+      this.chargingForm.relCoList = this.chargingForm.relCoList.map(item => item.zoningCode)
+      this.getRelateShopList(this.chargingForm.areaCode)
+      this.chargingDialog = true
+      this.title = '修改商户计费配置'
+    },
+    handleChargingDelete(row) {
+      this.$modal.confirm('是否确认删除').then(() => {
+        delCharging(row.id).then(() => {
+          this.getChargingList()
+          this.$modal.msgSuccess('删除成功')
+        })
+      })
+    },
+    chargingCancel() {
+      this.chargingDialog = false
+      this.resetForm('chargingForm')
+      this.chargingForm = this.$options.data().chargingForm
+    },
+    submitChargingForm() {
+      this.$refs['chargingForm'].validate(valid => {
+        if (valid) {
+          this.chargingForm.relCoList = this.chargingForm.relCoList.map(item => ({ priceCfgId: this.chargingForm.id, zoningCode: item }))
+          if (this.chargingForm.id) {
+            updateCharging(this.chargingForm).then(() => {
+              this.$modal.msgSuccess('修改成功')
+              this.chargingDialog = false
+              this.getChargingList()
+            })
+          } else {
+            addCharging(this.chargingForm).then(() => {
+              this.$modal.msgSuccess('新增成功')
+              this.chargingDialog = false
+              this.getChargingList()
+            })
+          }
+        }
+      })
     }
   }
 }
@@ -879,4 +1049,15 @@ export default {
     width: 100% !important;
   }
 }
+.custom-checkbox-group {
+  max-height: 120px;
+  overflow-y: auto;
+}
+</style>
+<style lang="scss">
+.custom-dialog {
+  .el-dialog__body {
+    padding-bottom: 0;
+  }
+}
 </style>