chuangte_bike_newxcx/page_shanghu/gongzuotai/CarModel.vue

239 lines
5.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="page">
<u-navbar title="车型管理" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
height='45'></u-navbar>
<view class="modelCard" v-for="(item,index) in list" :key="index">
<view class="tit">
{{item.name}}
</view>
<view class="line" style="margin-bottom: 18rpx;"></view>
<view class="info">
<!-- <view class="img">
<image :src="item.picture" mode=""></image>
</view> -->
<view class="lis">
<!-- <view class="info_li">
车型简介<span>{{item.description}}</span>
</view> -->
<view class="info_li">
最低电压<span>{{item.lowVoltage}}V</span>
</view>
<view class="info_li">
最高电压<span>{{item.fullVoltage}}V</span>
</view>
<view class="info_li">
满电续航<span>{{item.fullEndurance}}KM</span>
</view>
</view>
</view>
<!-- <view class="txt_li">
<view class="li">
所属门店<span>云行租车</span>
</view>
<view class="li">
满电续航<span>50.00km</span>
</view>
</view> -->
<view class="line"></view>
<view class="btn_li">
<view class="btn1" @click="del(item)">
删除
</view>
<view class="btn2" @click="todetail(item)">
编辑
</view>
</view>
</view>
<view class="" style="width: 100%;text-align: center;color: #ccc;margin-top: 30rpx;">
当前没有更多车型咯...
</view>
<view class="btn" @click="addmodel()">
新增车型
</view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#fff",
},
list:[],
areaId:''
}
},
onShow() {
if (uni.getStorageSync('adminAreaid')) {
this.areaId = uni.getStorageSync('adminAreaid')
}
this.getModelList()
},
methods: {
addmodel(){
uni.navigateTo({
url:'/page_shanghu/gongzuotai/modelMt'
})
},
del(item){
uni.showModal({
title: '确认删除',
content: '确定删除该车型?',
success: (res) => {
if (res.confirm) {
this.$u.delete(`/bst/model/${item.id}`).then((res) => {
if (res.code == 200) {
this.getModelList()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
})
} else if (res.cancel) {
// 用户取消删除操作
console.log('用户取消删除')
}
}
})
},
todetail(item){
uni.navigateTo({
url:'/page_shanghu/gongzuotai/modelMt?modelId='+item.id
})
},
// 请求所有车型
getModelList(){
this.$u.get(`/bst/model/list?pageNum=1&pageSize=999`).then((res) => {
if (res.code == 200) {
this.list=res.rows
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
})
},
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #f5f7fa;
}
.page {
padding: 24rpx;
padding-bottom: 180rpx;
background-color: #f5f7fa;
.modelCard {
margin-bottom: 24rpx;
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);
}
.tit {
padding: 32rpx;
font-size: 36rpx;
font-weight: 600;
color: #1a1a1a;
border-bottom: 1rpx solid #f0f0f0;
}
.info {
padding: 0 32rpx;
box-sizing: border-box;
display: flex;
.lis {
flex: 1;
.info_li {
margin-bottom: 24rpx;
font-size: 28rpx;
color: #666;
line-height: 1.6;
span {
color: #333;
font-weight: 500;
}
}
}
}
.btn_li {
display: flex;
border-top: 1rpx solid #f0f0f0;
.btn1, .btn2 {
flex: 1;
height: 96rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
font-weight: 500;
transition: all 0.2s ease;
&:active {
opacity: 0.8;
}
}
.btn1 {
color: #ff4d4f;
border-right: 1rpx solid #f0f0f0;
}
.btn2 {
color: #4C97E7;
}
}
}
.no-more {
padding: 48rpx 0;
font-size: 28rpx;
color: #999;
text-align: center;
}
.btn {
position: fixed;
left: 50%;
bottom: 48rpx;
transform: translateX(-50%);
width: 90%;
height: 96rpx;
background: linear-gradient(90deg, #4C97E7, #6ab0ff);
border-radius: 48rpx;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 36rpx;
font-weight: 500;
box-shadow: 0 8rpx 24rpx rgba(76, 151, 231, 0.3);
transition: all 0.2s ease;
&:active {
transform: translateX(-50%) scale(0.98);
}
}
}
</style>