Merge remote-tracking branch 'origin/master'

This commit is contained in:
SjS 2025-03-27 18:14:30 +08:00
commit c68290bf6d
4 changed files with 115 additions and 65 deletions

View File

@ -30,12 +30,11 @@ export const ChannelType = {
// 渠道API类型
export const ChannelApiType = {
WECHAT: "1", // 微信
ALI_PAY: "2", // 支付宝
BANK: "3", // 银行卡
TL_WX: "5", // 通联微信
TM_WX: "6", // 太米微信
XY_WX: "7", // 国通星驿微信
WECHAT: "WX", // 微信
ALI_PAY: "ALI", // 支付宝
BANK: "BANK", // 银行卡
BALANCE: "BALANCE", // 余额
TM_WX: "TM_WX", // 太米微信
}
// 运营区状态
@ -123,6 +122,12 @@ export const DeviceStatus = {
},
}
// 设备锁状态
export const DeviceLockStatus = {
LOCKED: "0", // 锁车
UNLOCKED: "1", // 开锁
}
// 加盟类型
export const AreaJoinType = {
JOIN: "1", // 加盟

View File

@ -276,7 +276,7 @@
icon="el-icon-unlock"
@click="handleUnlock(scope.row)"
v-has-permi="['bst:device:unlock']"
v-show="DeviceStatus.canAdminUnlock().includes(scope.row.status)"
v-show="canUnlock(scope.row)"
>开锁</el-button>
<el-button
size="mini"
@ -284,7 +284,7 @@
icon="el-icon-lock"
@click="handleLock(scope.row)"
v-has-permi="['bst:device:lock']"
v-show="DeviceStatus.canLock().includes(scope.row.status)"
v-show="canLock(scope.row)"
>锁车</el-button>
<el-button
size="mini"
@ -350,6 +350,7 @@ import FormCol from "@/components/FormCol/index.vue";
import DeviceEditDialog from './components/DeviceEditDialog.vue';
import BooleanTag from '@/components/BooleanTag/index.vue';
import { DeviceStatus } from '@/utils/enums';
import { $device } from '@/views/bst/device/mixins';
//
const defaultSort = {
@ -359,7 +360,7 @@ const defaultSort = {
export default {
name: "Device",
mixins: [$showColumns],
mixins: [$showColumns, $device],
dicts: ['device_status', 'device_lock_status', 'device_iot_status', 'device_online_status', 'device_quality'],
components: {FormCol, DeviceEditDialog, BooleanTag},
data() {

View File

@ -0,0 +1,18 @@
import { DeviceLockStatus, DeviceStatus } from '@/utils/enums';
export const $device = {
computed: {
canUnlock() {
return (row) => {
return DeviceStatus.canAdminUnlock().includes(row.status)
&& DeviceLockStatus.LOCKED == row.lockStatus
}
},
canLock() {
return (row) => {
return DeviceStatus.canLock().includes(row.status)
&& DeviceLockStatus.UNLOCKED == row.lockStatus
}
},
}
}

View File

@ -26,9 +26,14 @@
</el-select>
</form-col>
<form-col :span="span" label="预存金额" prop="depositAmount">
<el-input v-model="form.depositAmount" placeholder="请输入预存金额" type="number">
<template slot="append"></template>
</el-input>
<el-input-number
v-model="form.depositAmount"
placeholder="请输入预存金额"
type="number"
:precision="2"
controls-position="right"
style="width: calc(100% - 2em)"
/>
</form-col>
<form-col :span="span" label="免费时长" prop="freeRideTime">
<el-input v-model="form.freeRideTime" placeholder="请输入免费时长(分钟)">
@ -74,80 +79,96 @@
<el-row :gutter="10">
<collapse-panel title="计费规则" :value="true">
<template v-if="form.ridingRule === SuitRidingRule.START && form.startRule">
<el-input-number
v-model="form.startRule.startingTime"
placeholder="起步时间"
:min="0"
:precision="1"
controls-position="right"
style="width: 120px;"
/>
{{unitLabel(form.rentalUnit)}}以内起步价
<el-input-number
v-model="form.startRule.startingPrice"
placeholder="起步价"
type="number"
controls-position="right"
style="width: 120px;"
/>
<br/>超出起步时间后超出的时间每
<el-input-number
v-model="form.startRule.timeoutTime"
placeholder="超时时间"
type="number"
controls-position="right"
style="width: 120px;"
/>
{{unitLabel(form.rentalUnit)}}
<el-input-number
v-model="form.startRule.timeoutPrice"
placeholder="超时价格"
type="number"
controls-position="right"
style="width: 120px;"
/>
不满{{form.startRule.timeoutTime}}{{unitLabel(form.rentalUnit)}}{{form.startRule.timeoutTime}}{{unitLabel(form.rentalUnit)}}计算
</template>
<template v-else-if="form.ridingRule === SuitRidingRule.INTERVAL && form.intervalRule">
<div v-for="(item, index) in form.intervalRule" :key="index">
<div class="rule-row">
<el-input-number
size="small"
v-model="form.startRule.startingTime"
placeholder="起步时间"
:min="0"
:precision="0"
controls-position="right"
style="width: 120px;"
/>
{{unitLabel(form.rentalUnit)}}以内起步价
<el-input-number
size="small"
v-model="form.startRule.startingPrice"
placeholder="起步价"
type="number"
:precision="2"
controls-position="right"
style="width: 120px;"
/>
</div>
<div class="rule-row">
超出起步时间后超出的时间每
<el-input-number
size="small"
v-model="form.startRule.timeoutTime"
placeholder="超时时间"
type="number"
:precision="0"
controls-position="right"
style="width: 120px;"
/>
{{unitLabel(form.rentalUnit)}}
<el-input-number
size="small"
v-model="form.startRule.timeoutPrice"
placeholder="超时价格"
type="number"
:precision="2"
controls-position="right"
style="width: 120px;"
/>
不满{{form.startRule.timeoutTime}}{{unitLabel(form.rentalUnit)}}{{form.startRule.timeoutTime}}{{unitLabel(form.rentalUnit)}}计算
</div>
</template>
<template v-else-if="form.ridingRule === SuitRidingRule.INTERVAL && form.intervalRule">
<div v-for="(item, index) in form.intervalRule" :key="index" class="rule-row">
<el-input-number
size="small"
:value="startTime(index)"
controls-position="right"
style="width: 120px;"
placeholder="开始"
disabled
:precision="1"
:precision="0"
/>
<template v-if="index < form.intervalRule.length - 1">
~
<el-input-number
size="small"
v-model="item.end"
controls-position="right"
style="width: 120px;"
placeholder="结束"
:min="minEnd(index)"
:max="maxEnd(index)"
:precision="1"
/>
{{unitLabel(form.rentalUnit)}}之间
controls-position="right"
style="width: 120px;"
placeholder="结束"
:min="minEnd(index)"
:max="maxEnd(index)"
:precision="0"
/>
{{unitLabel(form.rentalUnit)}}之间
</template>
<template v-else>
之后
</template>
<el-input-number
size="small"
v-model="item.eachUnit"
controls-position="right"
style="width: 120px;"
placeholder="间隔"
:min="0.1"
:precision="1"
:min="1"
:precision="0"
:max="maxEachUnit(index)"
/>
{{unitLabel(form.rentalUnit)}}收费
<el-input-number
size="small"
v-model="item.fee"
controls-position="right"
style="width: 120px;"
@ -251,7 +272,7 @@ export default {
if (index == 0) {
return 0;
}
return this.form.intervalRule[index - 1].end;
return this.form.intervalRule[index - 1].end + 1;
}
},
//
@ -260,7 +281,7 @@ export default {
if (index >= this.form.intervalRule.length - 2 ) {
return 999999999;
} else {
return this.form.intervalRule[index + 1].end;
return this.form.intervalRule[index + 1].end - 1;
}
}
},
@ -293,7 +314,7 @@ export default {
addRidingRule(index) {
let current = this.form.intervalRule[index];
this.form.intervalRule.splice(index + 1, 0, {
start: current.end,
start: null,
end: current.end + 1,
eachUnit: 1,
fee: null,
@ -370,11 +391,13 @@ export default {
data.intervalRule.forEach((item,index) => {
if (index == 0) {
item.start = 0;
} else if (index == data.intervalRule.length - 1) {
item.end = null;
} else {
item.start = data.intervalRule[index - 1].end;
}
if (index == data.intervalRule.length - 1) {
item.end = null;
}
});
}
const promise = this.form.id != null ? updateSuit(data) : addSuit(data);
@ -395,4 +418,7 @@ export default {
</script>
<style lang="scss" scoped>
.rule-row {
margin-bottom: 4px;
}
</style>