This commit is contained in:
Sliverber 2024-05-22 17:28:19 +08:00
parent 654a2f0c75
commit 287187d01c
6 changed files with 436 additions and 227 deletions

View File

@ -5,7 +5,7 @@ VUE_APP_TITLE = 共享电动车管理系统
ENV = 'development'
# 共享电动车管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API = 'http://192.168.2.6:8080'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -5,7 +5,7 @@ VUE_APP_TITLE = 共享电动车管理系统
ENV = 'production'
# 共享电动车管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = 'https://dianche.chuantewulian.cn/prod-api'
# 小程序外链跳转设备
VUE_APP_WX_DEVICE_URL = 'weixin://dl/business/?appid=wx4d178f8c80348214&env_version=release'

View File

@ -5,6 +5,6 @@ NODE_ENV = production
# 测试环境配置
ENV = 'staging'
VUE_APP_BASE_API = 'https://dianche.chuantewulian.cn/prod-api'
# 共享电动车管理系统/测试环境
VUE_APP_BASE_API = '/stage-api'
VUE_APP_BASE_API = 'https://dianche.chuantewulian.cn/stage-api'

View File

@ -98,11 +98,16 @@
<el-table-column label="收费方式" align="center" prop="ruleStr" />
<el-table-column label="联系人" align="center" prop="contact" />
<el-table-column label="联系人电话" align="center" prop="phone" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.et_operating_area_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="状态" align="center" key="status" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
@ -193,12 +198,12 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="运营个性化图片" prop="picture">
<el-form-item label="运营个性化图片" prop="picture" label-width="140px">
<image-upload v-model="form.picture"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运营个性化标语" prop="slogan">
<el-form-item label="运营个性化标语" prop="slogan" label-width="120px">
<el-input v-model="form.slogan" placeholder="请输入运营个性化标语" style="" />
</el-form-item>
</el-col>
@ -211,7 +216,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="联系人电话" label-width="90" prop="phone">
<el-input v-model="form.phone" style="width: 85%" placeholder="请输入联系人电话" />
<el-input v-model="form.phone" style="width: 75%" placeholder="请输入联系人电话" />
</el-form-item>
</el-col>
</el-row>
@ -230,7 +235,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="客服电话" prop="phone">
<el-input v-model="form.servicPhone " placeholder="请输入客服电话" />
<el-input v-model="form.servicePhone " placeholder="请输入客服电话" />
</el-form-item>
</el-col>
</el-row>
@ -343,6 +348,11 @@
<el-input-number style="width: 50%" v-model="form.undercharge" placeholder="低于电量(%)不得骑行"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="骑行押金" label-width="150">
<el-input-number style="width: 50%" v-model="form.deposit" placeholder="骑行前需要充值的押金"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
@ -437,6 +447,7 @@ export default {
},
//
form: {
status:'1',
province: '',
city: '',
county: '',
@ -447,11 +458,15 @@ export default {
loading:false,
//
rules: {
}
areaName: [{ required: true, message: "运营区域不能为空", trigger: "blur" }],
contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
phone: [{ required: true, message: "联系人电话不能为空", trigger: "blur" }],
},
};
},
created() {
this.getList();
},
methods: {
getCityList() {
@ -482,6 +497,23 @@ export default {
console.log(console.log( this.form.provinceList,' this.form.provinceList'))
})
},
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + row.areaName + '"运营区吗?').then(function() {
let data={
areaId:row.areaId,
status:row.status
}
updateArea(data).then(response => {
this.getList();
});
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
cityChange(that){
let countyCode = 0
let cityname = ''
@ -556,7 +588,8 @@ export default {
latitude: null,
// parkingPoint: null,
createBy: null,
createTime: null
createTime: null,
status:'1',
};
this.resetForm("form");
},
@ -590,12 +623,22 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const areaId = row.areaId || this.ids
getArea(areaId).then(response => {
this.form = response.data;
this.form.ruleIds=response.ruleIds
this.open = true;
this.title = "修改运营区";
this.key++;
listFee().then(response => {
this.ruleOptions = response.rows;
this.open = true;
this.title = "添加运营区";
this.key++;
});
// this.getCityList()
this.getCityList();
});
},
openmaps(row) {

View File

@ -3,21 +3,12 @@
<!-- 搜索表单 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="套餐名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入套餐名称"
clearable
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.name" placeholder="请输入套餐名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
<el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
@ -29,46 +20,20 @@
<!-- 按钮和表格 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:fee:add']"
>新增</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:fee:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:fee:edit']"
>修改</el-button>
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['system:fee:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:fee:remove']"
>删除</el-button>
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['system:fee:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:fee:export']"
>导出</el-button>
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:fee:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -82,7 +47,7 @@
<el-table-column label="费用(元)" align="center" prop="fee" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
@ -92,132 +57,182 @@
</el-table-column>
<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="handleUpdate(scope.row)"
v-hasPermi="['system:fee:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:fee:remove']"
>删除</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:fee:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:fee:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改收费方式对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<!-- ...其他表单项... -->
<!-- 区间计费选项 -->
<div v-if="form.billingRule === '区间计费'">
<el-form-item label="启用区间">
<el-switch v-model="form.intervalEnabled" @change="toggleInterval" />
<el-form-item label="套餐名称" prop="name">
<el-input v-model="form.name" placeholder="请输入套餐名称" />
</el-form-item>
<el-form-item label="说明" prop="explain" :show-overflow-tooltip="true">
<el-input v-model="form.explain" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="状态" prop="status" v-if="title != '添加收费方式'">
<el-select v-model="form.status" placeholder="请选择状态">
<el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="还车结算">
<el-col :span="4">
<el-input v-model="form.autoRefundDeposit" placeholder="请输入" />
</el-col>
小时 后自动退押金
</el-form-item>
<el-form-item label="订单超过" prop="unit">
<el-col :span="4">
<el-input v-model="form.orderExceedMinutes" placeholder="请输入" />
</el-col>
<el-col :span="1.2">
分钟,
</el-col>
<el-col :span="4">
<el-input v-model="form.orderExceedWarn" placeholder="请输入" />
</el-col>
分钟语音提醒一次归还设备
</el-form-item>
<el-form-item label="免费骑行" prop="freeRideTime">
<el-col :span="4">
<el-input v-model="form.freeRideTime" placeholder="请输入" />
</el-col>
分钟
</el-form-item>
<!-- 套餐名称说明租赁单位等字段省略假设这些部分不需要修改 -->
<el-form-item label="租赁单位" prop="rentalUnit">
<el-radio-group v-model="form.rentalUnit" @change="handleUnitChange">
<el-radio label="minutes">按分钟</el-radio>
<el-radio label="hours">按小时</el-radio>
<el-radio label="day">按天</el-radio>
</el-radio-group>
</el-form-item>
<!-- 计费周期和封顶金额只在非按天计费时显示 -->
<!-- 骑行计费规则选择 -->
<el-form-item label="骑行计费规则" prop="ridingRule">
<el-radio-group v-model="form.ridingRule" @change="handleBillingRuleChange">
<el-radio label="1">起步价计费</el-radio>
<el-radio label="2">区间计费</el-radio>
</el-radio-group>
</el-form-item>
<!-- 起步价计费选项 -->
<div v-if="form.ridingRule == '1'">
<el-form-item label="起步价">
<el-row :gutter="10">
<el-col :span="6">
<el-input v-model="startPrice" placeholder="请输入起步价" />
</el-col>
<el-col :span="2" style="line-height: 32px;">
</el-col>
<el-col :span="6">
<el-input v-model="startTime" placeholder="请输入起步时间" />
</el-col>
<el-col :span="2" style="line-height: 32px;">
{{ timeUnit }})
</el-col>
</el-row>
</el-form-item>
<div v-if="form.intervalEnabled">
<div v-for="(interval, index) in form.intervals" :key="index" class="interval-group">
<el-row :gutter="10">
<el-col :span="2">
<span></span>
</el-col>
<el-col :span="4">
<el-input v-model="interval.start" :placeholder="'请输入开始时间(' + timeUnit + ''" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
~
</el-col>
<el-col :span="4">
<el-input v-model="interval.end" :placeholder="'请输入结束时间(' + timeUnit + ''" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
{{ timeUnit }} 之间
</el-col>
<el-col :span="4">
<el-input v-model="interval.each" placeholder="请输入时间间隔" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
{{ timeUnit }} 收费
</el-col>
<el-col :span="4">
<el-input v-model="interval.fee" placeholder="请输入费用" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
</el-col>
<el-col :span="2">
<el-button type="danger" icon="el-icon-delete" @click="removeInterval(index)">删除</el-button>
</el-col>
</el-row>
<el-form-item label="超出价">
<el-row :gutter="10">
<el-col :span="6">
<el-input v-model="exceedPrice" placeholder="请输入超出价格" />
</el-col>
<el-col :span="2" style="line-height: 32px;">
/
</el-col>
<el-col :span="6">
<el-input v-model="exceedTime" placeholder="请输入超出时间" />
</el-col>
<el-col :span="4" style="line-height: 32px;">
{{ timeUnit }}超出起步价后
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<div>
<br />1) 不是起步时间的仍按起步时间收取费用超出起步时间后的均匀计算
<br />2) 为避免免费用户使用切勿频繁切换
</div>
</el-form-item>
</div>
<!-- 区间计费选项 -->
<div v-if="form.ridingRule == '2'">
<el-form-item label="启用区间">
<!-- <el-switch v-model="form.enablelnterval" @change="toggleInterval" /> -->
</el-form-item>
<div>
<div v-for="(interval, index) in rule" :key="index" class="interval-group"
style="display: flex;flex-wrap: wrap;">
<el-form-item>
<el-row :gutter="10">
<div style="display: flex;flex-wrap: nowrap;">
<el-col :span="1">
<span></span>
</el-col>
<el-col :span="2">
<el-input v-model="interval.start" :placeholder="'请输入'" />
</el-col>
<el-col :span="0.5" style="line-height: 32px;">
~
</el-col>
<el-col :span="2">
<el-input v-model="interval.end" :placeholder="'请输入'" />
</el-col>
<el-col :span="2.5" style="line-height: 32px;">
{{ timeUnit }} 之间
</el-col>
<el-col :span="3" v-if="!form.enablelnterval">
<el-input v-model="interval.eachUnit" placeholder="请输入" />
</el-col>
<el-col :span="2" style="line-height: 32px;">
<span v-if="!form.enablelnterval">{{ timeUnit }}</span> 收费
</el-col>
<el-col :span="4">
<el-input v-model="interval.fee" placeholder="请输入" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
</el-col>
<el-col :span="2">
<el-button type="danger" icon="el-icon-delete" @click="removeInterval(index)">删除</el-button>
</el-col>
</div>
</el-row>
</el-form-item>
</div>
<el-form-item>
<el-button type="primary" icon="el-icon-plus" @click="addInterval">添加区间</el-button>
</el-form-item>
</div>
<div v-else>
<el-form-item>
<el-row :gutter="10">
<el-col :span="2">
<span></span>
</el-col>
<el-col :span="4">
<el-input placeholder="请输入开始时间" disabled />
</el-col>
<el-col :span="1" style="line-height: 32px;">
~
</el-col>
<el-col :span="4">
<el-input placeholder="请输入结束时间" disabled />
</el-col>
<el-col :span="1" style="line-height: 32px;">
{{ timeUnit }} 之间
</el-col>
<el-col :span="4">
<el-input placeholder="请输入时间间隔" disabled />
</el-col>
<el-col :span="1" style="line-height: 32px;">
{{ timeUnit }} 收费
</el-col>
<el-col :span="4">
<el-input placeholder="请输入费用" disabled />
</el-col>
<el-col :span="1" style="line-height: 32px;">
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-row :gutter="10">
<el-col :span="2">
<el-col :span="1">
<span>大于</span>
</el-col>
<el-col :span="4">
<el-input placeholder="请输入时间" />
<el-col :span="2">
<el-input placeholder="请输入" v-model="more.start" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
<el-col :span="3" style="line-height: 32px;">
{{ timeUnit }} 之后
</el-col>
<el-col :span="4">
<el-input placeholder="请输入时间间隔" />
<el-input placeholder="请输入" v-model="more.eachUnit" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
<el-col :span="2" style="line-height: 32px;">
{{ timeUnit }} 收费
</el-col>
<el-col :span="4">
<el-input placeholder="请输入费用" />
<el-col :span="2">
<el-input placeholder="请输入" v-model="more.fee" />
</el-col>
<el-col :span="1" style="line-height: 32px;">
@ -225,14 +240,54 @@
</el-row>
</el-form-item>
<el-form-item>
<div>
<el-button type="primary" icon="el-icon-plus" @click="addInterval">添加区间</el-button>
</el-form-item>
<el-form-item>
<div style="color: red;">
<br />1) 不是单位时间的仍按单位时间收取费用超出起步时间后的均匀计算
<br />2) 为避免免费用户使用切勿频繁切换
<br />3) 请注意第一个时间应该为0时间区间要连贯 不能出现有时间跨度的场景 1-20 每30分钟收费10元 大于50分钟之后每分钟10分钟收费30元这种情况否则无法计算
</div>
</el-form-item>
</div>
</div>
<el-form-item v-if="form.rentalUnit != 'day'" label="计费周期" prop="chargingCycle">
<el-radio-group v-model="form.chargingCycle">
<el-radio label="1">
订单生成后
<el-input v-model="form.chargingCycleValue"
style="width: 80px; display: inline-block; margin-left: 10px;" />
小时
</el-radio>
<el-radio label="2">
自定义时刻
<el-time-picker v-model="form.chargingCycleValue" placeholder="选择时间" style="margin-left: 10px;" />
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.rentalUnit != 'day'">
<div>
<br />1) 若计费周期为订单生成后X小时每达到X小时订单按规则重新计费各周期内金额总和为订单总费用
<br />2) 若计费周期为自定义时刻每当达到该时刻订单按规则重新计费各周期内金额总和为订单总费用
</div>
</el-form-item>
<el-form-item v-if="form.rentalUnit != 'day'" label="封顶金额" prop="cappedAmount">
<el-col :span="4">
<el-input v-model="form.cappedAmount" placeholder="请输入封顶金额" />
</el-col>
</el-form-item>
<el-form-item v-if="form.rentalUnit != 'day'">
<div>
在单个计费周期内达到封顶金额后则订单费用不再增加超过计费周期后在新的周期内重新计费订单总费用继续增加
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -266,26 +321,75 @@ export default {
status: null,
},
form: {
name: null,
explain: null,
unit: '按分钟',
billingCycle: null,
maxAmount: null,
billingRule: '起步价计费',
startPrice: null,
startTime: null,
exceedTime: null,
exceedPrice: null,
intervalEnabled: false,
intervals: [{ start: '', end: '', each: '', fee: '' }],
name: '',
explain: '',
status: "正常",
autoRefundDeposit: '',
orderExceedMinutes: '',
orderExceedWarn: '',
freeRideTime: '',
rentalUnit: 'minutes',
ridingRule: '1',
chargingCycle: '',
chargingCycleValue: '',
cappedAmount: '',
rule: [{ start: '', end: '', eachUnit: '', fee: '' }],
// chargingCycle: 1, //
// chargingCycleValue: '', //
},
exceedTime: '',
startPrice: '',
startTime: '',
exceedPrice: '',
enablelnterval: false,
rule: [{ start: '', end: '', eachUnit: '', fee: '' }],
more: { start: '', end: '9999', eachUnit: '', fee: '' },
timeUnit: '分钟',
rules: {
name: [{ required: true, message: '请输入套餐名称', trigger: 'blur' }],
explain: [{ required: true, message: '请输入说明', trigger: 'blur' }],
unit: [{ required: true, message: '请选择租赁单位', trigger: 'change' }],
billingRule: [{ required: true, message: '请选择骑行计费规则', trigger: 'change' }],
}
name: [
{ required: true, message: '请输入套餐名称', trigger: 'blur' },
],
explain: [
{ required: true, message: '请输入说明', trigger: 'blur' },
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' },
],
// autoRefundDeposit: [
// { required: true, message: '', trigger: 'blur' },
// ],
orderExceedMinutes: [
{ required: true, message: '请输入订单超过时间', trigger: 'blur' },
],
orderExceedWarn: [
{ required: true, message: '请输入订单提醒时间', trigger: 'blur' },
],
freeRideTime: [
{ required: true, message: '请输入免费骑行时间', trigger: 'blur' },
],
rentalUnit: [
{ required: true, message: '请选择租赁单位', trigger: 'change' },
],
chargingCycle: [
{ required: true, message: '请选择计费周期', trigger: 'change' },
],
cappedAmount: [
{ required: true, message: '请输入封顶金额', trigger: 'blur' },
],
ridingRule: [
{ required: true, message: '请选择骑行计费规则', trigger: 'change' },
],
hourlyFee: [
{ required: true, message: '请输入每小时收费', trigger: 'blur' },
],
perKmFee: [
{ required: true, message: '请输入每公里收费', trigger: 'blur' },
],
sectionCharges: [
{ required: true, message: '请输入区间收费', trigger: 'blur' },
],
},
};
},
created() {
@ -293,21 +397,26 @@ export default {
},
methods: {
handleUnitChange() {
this.timeUnit = this.form.unit === '按分钟' ? '分钟' : (this.form.unit === '按小时' ? '小时' : '天');
if (this.form.unit === '按天') {
this.form.intervals = [];
if (this.form.rentalUnit == 'minutes') {
this.timeUnit = '分钟';
} else if (this.form.rentalUnit == 'hours') {
this.timeUnit = '小时';
} else if (this.form.rentalUnit == 'day') {
this.timeUnit = '天';
//
// this.form.intervals = [];
}
},
handleBillingRuleChange() {
if (this.form.billingRule === '区间计费' && this.form.intervals.length === 0) {
if (this.form.ridingRule === '2' && this.rule.length === 0) {
this.addInterval();
}
},
addInterval() {
this.form.intervals.push({ start: '', end: '', each: '', fee: '' });
this.rule.push({ start: '', end: '', eachUnit: '', fee: '' });
},
removeInterval(index) {
this.form.intervals.splice(index, 1);
this.rule.splice(index, 1);
},
getList() {
this.loading = true;
@ -323,20 +432,30 @@ export default {
},
reset() {
this.form = {
name: null,
explain: null,
unit: '按分钟',
billingCycle: null,
maxAmount: null,
billingRule: '起步价计费',
startPrice: null,
startTime: null,
exceedTime: null,
exceedPrice: null,
intervalEnabled: false,
intervals: [{ start: '', end: '', each: '', fee: '' }]
};
this.resetForm("form");
name: '',
explain: '',
status: "正常",
autoRefundDeposit: '',
orderExceedMinutes: '',
orderExceedWarn: '',
freeRideTime: '',
rentalUnit: 'minutes',
ridingRule: '1',
chargingCycle: '',
chargingCycleValue: '',
cappedAmount: '',
}
this.enablelnterval = false,
this.more = { start: '', end: '9999', eachUnit: '', fee: '' }
this.rule = [{ start: '', end: '', eachUnit: '', fee: '' }],
this.exceedTime = '',
this.startPrice = '',
this.startTime = '',
this.exceedPrice = '',
this.resetForm("form")
},
handleQuery() {
this.queryParams.pageNum = 1;
@ -361,6 +480,20 @@ export default {
const ruleId = row.ruleId || this.ids;
getFee(ruleId).then(response => {
this.form = response.data;
// delete this.form.ridingRuleJson;
let json = JSON.parse(response.data.ridingRuleJson)
if (this.form.ridingRule == 1) {
this.exceedTime = json.exceedTime
this.startPrice = json.startPrice
this.startTime = json.startTime
this.exceedPrice = json.exceedPrice
} else {
this.rule = json.rule.slice(0, -1);
//
this.more = json.rule[json.rule.length - 1];
}
console.log(this.form,'this.formthis.form');
this.open = true;
this.title = "修改收费方式";
});
@ -368,17 +501,40 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
// this.form.rule.push(this.more)
// console.log(this.form,'mmmmmmmmmmmmm');
let data = { ...this.form }; // 使 this.form
this.rule.push(this.more)
data.ridingRuleJson = {}
if (this.form.ridingRule == 2) {
data.ridingRuleJson.rule = this.rule
data.ridingRuleJson.enablelnterval = this.enablelnterval
} else {
data.ridingRuleJson.exceedTime = this.exceedTime
data.ridingRuleJson.startPrice = this.startPrice
data.ridingRuleJson.startTime = this.startTime
data.ridingRuleJson.exceedPrice = this.exceedPrice
}
data.ridingRuleJson = JSON.stringify(data.ridingRuleJson);
// console.log(data, 'mmmmmmmmmmmmm');
if (this.form.ruleId != null) {
updateFee(this.form).then(() => {
updateFee(data).then(() => {
this.$message.success("修改成功");
this.open = false;
this.getList();
this.reset()
});
} else {
addFee(this.form).then(() => {
addFee(data).then(() => {
this.$message.success("新增成功");
this.open = false;
this.getList();
this.reset()
});
}
}
@ -392,7 +548,7 @@ export default {
}).then(() => {
this.getList();
this.$message.success("删除成功");
}).catch(() => {});
}).catch(() => { });
},
handleExport() {
this.download('system/fee/export', {
@ -403,8 +559,16 @@ export default {
this.$refs[formName] && this.$refs[formName].resetFields();
},
toggleInterval() {
if (!this.form.intervalEnabled) {
this.form.intervals = [{ start: '', end: '', each: '', fee: '' }];
if (!this.form.enablelnterval) {
this.more = { start: '', end: '9999', eachUnit: '', fee: '' }
this.enablelnterval = false
this.rule = [{ start: '', end: '', eachUnit: '', fee: '' }]
this.exceedTime = ''
this.startPrice = ''
this.startTime = ''
this.exceedPrice = ''
}
},
}
@ -415,11 +579,13 @@ export default {
.interval-group {
margin-bottom: 10px;
}
.el-row {
align-items: center;
}
.el-col {
display: flex;
align-items: center;
}
</style>
</style>

View File

@ -28,22 +28,22 @@ module.exports = {
// 如果你不需要生产环境的 source map可以将其设置为 false 以加速生产环境构建。
productionSourceMap: false,
// webpack-dev-server 相关配置
devServer: {
host: '0.0.0.0',
port: port,
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://192.168.2.6:8080`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
}
}
},
disableHostCheck: true
},
// devServer: {
// host: '0.0.0.0',
// port: port,
// open: true,
// proxy: {
// // detail: https://cli.vuejs.org/config/#devserver-proxy
// [process.env.VUE_APP_BASE_API]: {
// target: `http://192.168.2.6:8080`,
// changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_BASE_API]: ''
// }
// }
// },
// disableHostCheck: true
// },
css: {
loaderOptions: {
sass: {