<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.model}} </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="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:'/pages_adminSet/modelMt' }) }, del(item){ // 显示确认删除的提示框 uni.showModal({ title: '确认删除', content: '确定删除该车型?', success: (res) => { if (res.confirm) { // 如果用户点击了确认,执行删除操作 this.$u.delete(`/system/model/` + item.modelId).then((res) => { if (res.code == 200) { this.getModelList(); // 刷新列表 } else { // 处理接口返回错误的情况 uni.showToast({ title: '删除失败,请稍后再试', icon: 'none' }); } }).catch(error => { // 处理接口请求失败的情况 uni.showToast({ title: '请求失败,请稍后再试', icon: 'none' }); }); } else if (res.cancel) { // 用户取消删除操作 console.log('用户取消删除'); } } }); }, todetail(item){ uni.navigateTo({ url:'/pages_adminSet/modelMt?modelId='+item.modelId }) }, getModelList(){ this.$u.get(`/system/area/selectDeptByAreaId/`+this.areaId).then((res) => { if (res.code == 200) { this.list=res.data.modelList } else { // 处理接口返回错误的情况 } }).catch(error => { // 处理接口请求失败的情况 }); }, } } </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: center; 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: #808080 ; } } } } .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>