mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
配置充电停车优惠
This commit is contained in:
@@ -173,3 +173,20 @@ export function updateThirdPartyStationRelation(data) {
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 保存充电停车优惠配置
|
||||
export function saveChargeParkingDiscount(data) {
|
||||
return request({
|
||||
url: '/pile/station/saveChargeParkingDiscount',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询站点充电停车优惠配置
|
||||
export function getChargeParkingDiscount(stationId) {
|
||||
return request({
|
||||
url: '/pile/station/getChargeParkingDiscount/' + stationId,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@ export function formatDate(cellValue) {
|
||||
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
|
||||
}
|
||||
|
||||
export function formatTimeStr(time) {
|
||||
return `${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} time
|
||||
* @param {string} option
|
||||
|
||||
@@ -193,92 +193,106 @@
|
||||
|
||||
<el-card style="margin-bottom: 10px">
|
||||
<h2>绑定停车平台V2(配置完成后,订单完成将自动下发优惠券)</h2>
|
||||
<el-button
|
||||
icon="el-icon-edit"
|
||||
size="big"
|
||||
@click="parkingOpenEdit"
|
||||
v-has-permi="['pile:station:edit']"
|
||||
>编辑参数
|
||||
</el-button>
|
||||
<el-form
|
||||
ref="parkingForm"
|
||||
:model="parkingInfo"
|
||||
:model="chargeParkingDiscount"
|
||||
label-position="right"
|
||||
label-width="200px"
|
||||
style="margin-top: 10px"
|
||||
>
|
||||
<!-- 新增规则配置部分 -->
|
||||
<el-row>
|
||||
<el-col :span="5">
|
||||
<el-form-item label="停车平台名称:" prop="type">
|
||||
<el-select
|
||||
v-model="parkingInfo.parkingName"
|
||||
placeholder="请选择停车平台名称"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 220px"
|
||||
:disabled="parkingDisableFlag"
|
||||
@change="getParkingInfo($event)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in parkingInfoList"
|
||||
:key="item.id"
|
||||
:label="item.parkingName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item>
|
||||
<el-button
|
||||
size="big"
|
||||
@click="saveParkingSetting(parkingInfo.id)"
|
||||
v-has-permi="['pile:station:edit']"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="停车场库secretKey:" prop="secretKey">
|
||||
<el-input
|
||||
placeholder="请输入"
|
||||
v-model="parkingInfo.secretKey"
|
||||
:disabled="true"
|
||||
/>
|
||||
<el-form-item label="条件类型:" prop="conditionType">
|
||||
<el-radio-group v-model="chargeParkingDiscount.conditionType">
|
||||
<el-radio :label="1">固定电量</el-radio>
|
||||
<el-radio :label="2">固定时长</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="停车场库appId:" prop="appId">
|
||||
<el-form-item label="条件值:" prop="conditionValue">
|
||||
<el-input
|
||||
placeholder="请输入"
|
||||
v-model="parkingInfo.appId"
|
||||
:disabled="true"
|
||||
v-model="chargeParkingDiscount.conditionValue"
|
||||
placeholder="请输入数值"
|
||||
type="number"
|
||||
min="0"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="票券id:" prop="couponId">
|
||||
<el-input
|
||||
placeholder="请输入"
|
||||
v-model="parkingInfo.couponId"
|
||||
:disabled="false"
|
||||
/>
|
||||
<el-form-item label="优惠类型:" prop="discountType">
|
||||
<el-radio-group v-model="chargeParkingDiscount.discountType">
|
||||
<el-radio :label="1">减时间(分钟)</el-radio>
|
||||
<el-radio :label="2">减金额(元)</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="停车场库商户id:" prop="parkingMerchantId">
|
||||
<el-form-item label="优惠值:" prop="discountValue">
|
||||
<el-input
|
||||
placeholder="请输入"
|
||||
v-model="parkingInfo.parkingMerchantId"
|
||||
:disabled="false"
|
||||
v-model="chargeParkingDiscount.discountValue"
|
||||
placeholder="请输入数值"
|
||||
type="number"
|
||||
min="0"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="生效时间:" prop="timeRange">
|
||||
<!-- 开始时间 -->
|
||||
<el-time-select
|
||||
v-model="chargeParkingDiscount.startTime"
|
||||
placeholder="起始时间"
|
||||
:picker-options="{
|
||||
start: '00:00',
|
||||
step: '00:30',
|
||||
end: '23:59'
|
||||
}"
|
||||
/>
|
||||
<span class="separator">至</span>
|
||||
<!-- 结束时间 -->
|
||||
<el-time-select
|
||||
v-model="chargeParkingDiscount.endTime"
|
||||
placeholder="结束时间"
|
||||
:picker-options="{
|
||||
start: '00:00',
|
||||
step: '00:30',
|
||||
end: '23:59',
|
||||
}"
|
||||
/>
|
||||
|
||||
<!-- 跨天提示 -->
|
||||
<div v-if="isCrossDay" class="cross-day-tip">
|
||||
<i class="el-icon-warning"></i>
|
||||
已跨天(次日 {{ chargeParkingDiscount.endTime }} 结束)
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item>
|
||||
<el-button
|
||||
size="big"
|
||||
@click="saveChargeParkingDiscount"
|
||||
v-has-permi="['pile:station:edit']"
|
||||
>
|
||||
保存充电停车优惠配置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
@@ -350,11 +364,12 @@ import {
|
||||
getParkingInfoList,
|
||||
bindParkingPlatform,
|
||||
getRelationByStationId,
|
||||
updateThirdPartyStationRelation,
|
||||
updateThirdPartyStationRelation, saveChargeParkingDiscount,
|
||||
} from "@/api/pile/station";
|
||||
import Whitelist from "@/views/pile/station/stationWhiteList";
|
||||
import OrderReport from "./orderReport.vue";
|
||||
import Config from "@/views/pile/station/splitConfig.vue";
|
||||
import {formatTime, formatTimeStr} from "@/utils";
|
||||
|
||||
export default {
|
||||
dicts: ["third_party_type"],
|
||||
@@ -378,6 +393,15 @@ export default {
|
||||
prefix: "",
|
||||
},
|
||||
parkingInfo: {},
|
||||
chargeParkingDiscount:{
|
||||
stationId: "",
|
||||
conditionType: "",
|
||||
conditionValue: "",
|
||||
discountType: "",
|
||||
discountValue: "",
|
||||
startTime: "",
|
||||
endTime: ""
|
||||
},
|
||||
parkingInfoList: [],
|
||||
queryGroundLockQrCode: "",
|
||||
dialogTitle: "",
|
||||
@@ -410,6 +434,15 @@ export default {
|
||||
mounted() {
|
||||
this.initializeData(this.activeName);
|
||||
},
|
||||
computed: {
|
||||
// 判断是否跨天
|
||||
isCrossDay() {
|
||||
if (!this.chargeParkingDiscount.startTime || !this.chargeParkingDiscount.endTime) return false
|
||||
const start = this.timeToMinutes(this.chargeParkingDiscount.startTime)
|
||||
const end = this.timeToMinutes(this.chargeParkingDiscount.endTime)
|
||||
return end <= start
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 更新页面title显示
|
||||
updateTitle() {
|
||||
@@ -571,6 +604,21 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 时间转换为分钟数
|
||||
timeToMinutes(time) {
|
||||
const [hours, minutes] = time.split(':').map(Number)
|
||||
return hours * 60 + minutes
|
||||
},
|
||||
|
||||
// 保存充电停车配置
|
||||
saveChargeParkingDiscount() {
|
||||
this.chargeParkingDiscount.stationId = this.stationId;
|
||||
saveChargeParkingDiscount(this.chargeParkingDiscount).then((response) => {
|
||||
console.log("response", response);
|
||||
this.$message.success(response.msg);
|
||||
})
|
||||
},
|
||||
|
||||
// 绑定站点与停车平台配置
|
||||
saveParkingSetting(parkingId) {
|
||||
console.log("parkingId", parkingId, this.stationId);
|
||||
@@ -618,6 +666,7 @@ export default {
|
||||
this.exchange.push(id);
|
||||
},
|
||||
},
|
||||
|
||||
//监听复选框状态
|
||||
watch: {
|
||||
checkList: {
|
||||
@@ -644,4 +693,24 @@ export default {
|
||||
::v-deep .Input .el-input--medium {
|
||||
width: 400px;
|
||||
}
|
||||
.time-range-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.separator {
|
||||
color: #606266;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.cross-day-tip {
|
||||
color: #e6a23c;
|
||||
margin-left: 10px;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user