chuangte_bike_newxcx/page_shanghu/gongzuotai/ChargingDetail.vue

490 lines
12 KiB
Vue
Raw Normal View History

2025-04-01 21:35:30 +08:00
<template>
<view class="page">
<u-navbar title="收费模版编辑" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
height='45'></u-navbar>
<view class="card">
<view class="card_li">
<view class="tops">
<view class="card_left">
套餐名称
</view>
<view class="card_right">
<input type="text" v-model="data.name" placeholder="请输入套餐名称" class="input"
placeholder-style="color:#C7CDD3">
</view>
</view>
</view>
<view class="card_li">
<view class="tops">
<view class="card_left">
说明
</view>
<view class="card_right">
<input type="text" v-model="data.instructions" placeholder="请输入说明内容" class="input"
placeholder-style="color:#C7CDD3">
</view>
</view>
</view>
</view>
<view class="card">
<view class="card_li">
<view class="tops">
<view class="card_left">
免费骑行
</view>
<view class="card_right">
<input type="text" v-model="data.freeRideTime" placeholder="可以免费骑行的时间" class="input"
placeholder-style="color:#C7CDD3">
</view>
</view>
<view class="tips">
可以免费骑行的时间(分钟)
</view>
</view>
<!-- <view class="card_li">
<view class="tops">
<view class="card_left">
还车结算
</view>
<view class="card_right">
<input type="text" v-model="data.autoRefundDeposit" placeholder="多少小时后自动退押金" class="input"
placeholder-style="color:#C7CDD3">
</view>
</view>
<view class="tips">
多少小时后自动退押金(小时)
</view>
</view> -->
<view class="card_li">
<view class="tops">
<view class="card_left">
租赁单位
</view>
<view class="card_right">
<u-radio-group v-model="timevalue" @change="radioGroupChange">
<u-radio v-for="(item, index) in timeList" :key="index" :name="item.name"
:disabled="item.disabled">
{{item.name}}
</u-radio>
</u-radio-group>
</view>
</view>
</view>
<view class="card_li">
<view class="rule">
起步价
<input type="text" v-model="startingPrice" placeholder=" " class="input"
placeholder-style="color:#C7CDD3">
<input type="text" v-model="startingTime" placeholder=" " class="input"
placeholder-style="color:#C7CDD3"> {{timevalue}}
</view>
<view class="tips">
<!-- 可以免费骑行的时间 -->
</view>
</view>
<view class="card_li">
<view class="rule">
超出价
<input type="text" v-model="timeoutPrice" placeholder=" " class="input"
placeholder-style="color:#C7CDD3">
/ <input type="text" v-model="timeoutTime" placeholder=" " class="input"
2025-04-10 08:57:21 +08:00
placeholder-style="color:#C7CDD3">{{timevalue}}
2025-04-01 21:35:30 +08:00
</view>
<view class="tips" style="text-align: left;">
超出起步价后
</view>
<view class="tips" style="text-align: left;">
2025-04-10 08:57:21 +08:00
<view class="">
1.为避免免费用户使用切勿频繁切换
</view>
<view class="" style="padding-left: 48rpx;">
2.不是起步时间的仍按起步时间收取费用超出起步时间后的均匀计算
</view>
2025-04-01 21:35:30 +08:00
</view>
</view>
<!-- <view class="card_li">
<view class="tops">
<view class="card_left">
计费周期
</view>
<view class="card_right">
订单生成后
<input type="text" v-model="data.chargingCycleValue" placeholder="多少小时后自动退押金" class="input"
placeholder-style="color:#C7CDD3" style="width: 100rpx;">小时
</view>
</view>
<view class="tips" style="text-align: left;">
1) 若计费周期为订单生成后X小时每达到X小时订单按规则重新计费各周期内金额总和为订单总费用
2) 若计费周期为自定义时刻每当达到该时刻订单按规则重新计费各周期内金额总和为订单总费用
</view>
</view> -->
<view class="card_li">
<view class="tops">
<view class="card_left">
预存
</view>
2025-04-10 08:57:21 +08:00
<view class="card_right" style="display: flex;align-items: center;">
2025-04-01 21:35:30 +08:00
<input type="text" v-model="data.depositAmount" placeholder="多少小时后自动退押金" class="input"
2025-04-10 08:57:21 +08:00
placeholder-style="color:#C7CDD3" style="width: 100rpx;margin-right: 10rpx;">
2025-04-01 21:35:30 +08:00
</view>
</view>
<view class="tips" style="text-align: left;">
在单个计费周期内达到封顶金额后则订单费用不再增加超过计费周期后在新的周期内重新计费订单总费用继续增加
</view>
</view>
</view>
<view class="btn_box">
<view class="btn1" @click="backpage()">
取消
</view>
<view class="btn2" @click="sub">
保存
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#fff",
},
showpart: false,
list: [],
Accessorylist: [],
chooseIdxArr: [], // 存储选中的索引
timevalue: '按分钟',
timeList: [{
name: '按分钟',
disabled: false
},
{
name: '按小时',
disabled: false
},
2025-04-23 17:50:42 +08:00
{
name: '按天',
disabled: false
},
2025-04-01 21:35:30 +08:00
],
startingPrice: "",
startingTime: '',
timeoutPrice: '',
timeoutTime: '',
data: {
name: '',
instructions: '',
status: "0",
autoRefundDeposit: '0',
orderExceedMinutes: '',
orderExceedWarn: '',
freeRideTime: '5',
rentalUnit: 'minutes',
ridingRule: '1',
chargingCycle: '1',
chargingCycleValue: '24',
depositAmount: '200',
timeoutTime: '',
startingTime: '',
orderNum:0,
userId:'',
startRule:{}
},
ruleId: '',
userinfo:{}
}
},
onLoad(e) {
if (e.ruleId) {
this.ruleId = e.ruleId
this.getFeeInfo()
}
},
onShow() {
this.getinfo()
},
methods: {
getinfo() {
this.$u.get("/getInfo").then((res) => {
if (res.code == 200) {
this.userinfo = res.user
this.data.userId = this.userinfo.userId
}
})
},
getFeeInfo() {
this.$u.get(`/bst/suit/${this.ruleId}`).then((res) => {
if (res.code == 200) {
this.data = res.data;
if (this.data.rentalUnit == 'minutes') {
this.timevalue='按分钟'
} else if (this.data.rentalUnit == 'hours') {
this.timevalue='按小时'
} else if (this.data.rentalUnit == 'day') {
this.timevalue='按天'
}
if (this.data.area) {
this.returnVerify = this.data.area.returnVerify;
}
// console.log("-------returnVerify------",this.returnVerify)
// delete this.form.startRule;
let json = res.data.startRule
if (this.data.ridingRule == 1) {
this.timeoutTime = json.timeoutTime
this.startingPrice = json.startingPrice
this.startingTime = json.startingTime
this.timeoutPrice = json.timeoutPrice
} else {
this.rule = json.rule.slice(0, -1);
// 获取数组的最后一个元素
this.more = json.rule[json.rule.length - 1]
}
console.log(this.data, 'this.formthis.form')
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 1000
})
}
})
},
backpage() {
uni.navigateBack()
},
// 选中任一radio时由radio-group触发
radioGroupChange(e) {
if (e == '按分钟') {
this.data.rentalUnit = 'minutes'
2025-04-23 17:50:42 +08:00
} else if(e == '按小时'){
2025-04-01 21:35:30 +08:00
this.data.rentalUnit = 'hours'
2025-04-23 17:50:42 +08:00
}else {
this.data.rentalUnit = 'day'
2025-04-01 21:35:30 +08:00
}
},
sub() {
let data = {
...this.data,
type:1
}
data.startRule = {}
if (this.data.ridingRule == 2) {
data.startRule.rule = this.rule
data.startRule.enablelnterval = this.enablelnterval
} else {
data.startRule.timeoutTime = this.timeoutTime
data.startRule.startingPrice = this.startingPrice
data.startRule.startingTime = this.startingTime
data.startRule.timeoutPrice = this.timeoutPrice
}
data.startRule = data.startRule
console.log(data, 'mmmmmmmmmmmmm')
if (this.ruleId != '') {
this.$u.put(`/bst/suit`, data).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '修改成功',
icon: 'success',
duration: 1000
})
setTimeout(() => {
uni.navigateBack()
}, 1100)
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
} else {
this.$u.post(`/bst/suit`, data).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '添加成功',
icon: 'success',
duration: 1000
})
setTimeout(() => {
uni.navigateBack()
}, 1100)
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
}
}
}
</script>
<style lang="scss">
2025-04-10 08:57:21 +08:00
page {
background-color: #f5f7fa;
}
2025-04-01 21:35:30 +08:00
.page {
2025-04-10 08:57:21 +08:00
padding: 24rpx;
padding-bottom: 180rpx;
background-color: #f5f7fa;
.card {
margin-bottom: 32rpx;
background: #ffffff;
border-radius: 16rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.04);
overflow: hidden;
transition: all 0.3s ease;
&:active {
transform: translateY(2rpx);
}
.card_li {
padding: 32rpx;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.tops {
display: flex;
align-items: center;
.card_left {
font-size: 32rpx;
color: #333;
font-weight: 500;
width: 180rpx;
}
.card_right {
flex: 1;
.input {
width: 90%;
padding: 16rpx 24rpx;
background: #f8f9fa;
border-radius: 12rpx;
font-size: 30rpx;
color: #333;
border: 1rpx solid #e6e8eb;
transition: all 0.2s ease;
&:focus {
border-color: #4C97E7;
box-shadow: 0 0 0 2rpx rgba(76, 151, 231, 0.2);
}
}
.u-radio-group {
display: flex;
2025-04-23 17:50:42 +08:00
// gap: 40rpx;
2025-04-10 08:57:21 +08:00
.u-radio {
font-size: 28rpx;
color: #666;
&.is-checked {
color: #4C97E7;
}
}
}
}
}
.rule {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12rpx;
font-size: 30rpx;
color: #333;
.input {
padding: 8rpx 8rpx;
background: #f8f9fa;
border-radius: 8rpx;
border: 1rpx solid #e6e8eb;
width: 120rpx;
text-align: center;
font-size: 28rpx;
color: #333;
}
}
.tips {
margin-top: 16rpx;
font-size: 24rpx;
color: #999;
line-height: 1.6;
&.warning {
color: #faad14;
background: #fffbe6;
padding: 12rpx 16rpx;
border-radius: 8rpx;
margin-top: 16rpx;
}
}
}
}
.btn_box {
position: fixed;
bottom: 32rpx;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 24rpx;
width: 90%;
z-index: 10;
.btn1, .btn2 {
flex: 1;
height: 96rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
font-weight: 500;
border-radius: 48rpx;
transition: all 0.2s ease;
&:active {
transform: scale(0.98);
}
}
.btn1 {
background: #fff;
color: #4C97E7;
border: 1rpx solid #4C97E7;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
}
.btn2 {
background: linear-gradient(90deg, #4C97E7, #6ab0ff);
color: #fff;
box-shadow: 0 8rpx 24rpx rgba(76, 151, 231, 0.3);
}
}
2025-04-01 21:35:30 +08:00
}
</style>