chuangte_bike_newxcx/page_shanghu/gongzuotai/CarModel.vue

249 lines
5.1 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="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" style="margin-top: 26rpx;"></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 {}
.page {
padding-bottom: 170rpx;
.modelCard {
margin-top: 22rpx;
width: 750rpx;
padding-bottom: 12rpx;
background: #FFFFFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.info{
margin-left: 42rpx;
display: flex;
flex-wrap: nowrap;
align-items: stretch; /* 让左右两边的高度一致 */
.img{
display: flex;
align-items: center;
justify-content: center;
background: #EFEFEF;
border-radius: 10rpx;
width: 218rpx;
min-height:134rpx ;
image{
width: 173.59rpx;
height: 133.22rpx;
}
}
.lis{
margin-left: 60rpx;
.info_li{
margin-top: 8rpx;
font-weight: 400;
font-size: 28rpx;
color: #808080;
span{
color: #000 ;
}
}
}
}
.tit{
padding: 24rpx 32rpx;
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
}
.line{
width: 100%;
height: 1rpx;
background: #D8D8D8;
}
.btn_li{
margin-top: 16rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
.btn1{
display: flex;
align-items: center;
justify-content: center;
width: 50%;
height: 67rpx;
font-weight: 600;
font-size: 32rpx;
color: #FF1C1C;
border-right: 1rpx solid #FF1C1C ;
}
.btn2{
display: flex;
align-items: center;
justify-content: center;
width: 50%;
height: 67rpx;
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
// border-right: 1rpx solid #FF1C1C ;
}
}
.txt_li{
margin-top: 8rpx;
width: 100%;
display: flex;
flex-wrap: nowrap;
.li{
width: 50%;
padding-left: 28rpx;
font-weight: 400;
font-size: 28rpx;
color: #808080;
span{
color: #808080 ;
}
}
}
}
.btn {
position: fixed;
left: 40rpx;
bottom: 48rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
width: 672rpx;
height: 100rpx;
background: #4C97E7;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-weight: 500;
font-size: 40rpx;
color: #FFFFFF;
}
}
</style>