123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <template>
- <view class="box">
- <view class="carlistBox">
- <view class="line" v-for="(item,index) in carList" @click="itemClick(item)">
- <view class="lineCont">
- <view>
- <image :src="item.brandLogo" mode="widthFix" class="brandLogo"></image>
- </view>
- <view style="padding-left: 29rpx;">
- <view class="carName">
- <span>{{item.brand}} {{item.series}}</span>
- <view class="plateNumber">{{item.plateNumber}}</view>
- </view>
- <view class="carMS">{{item.carModel}}</view>
- </view>
- </view>
- <view class="lineBottom">
- <view class="lineDel" @click.stop="delCar(item.id)">删除</view>
- <view class="lineDel" @click.stop="editCar(item.id)">编辑</view>
- <view class="Default" v-show="item.isDefault!=1" @click.stop="defaultCar(item)">设为默认</view>
- <view class="DefaultYES" v-show="item.isDefault==1">已设为默认</view>
- </view>
- <view class="DefaultIcon" v-show="item.isDefault==1">默认</view>
- </view>
- </view>
- <view v-if="carList==''&&loding" class="nodataBox">
- <image src="../../static/img/nodata.png" mode="widthFix" class="nodataImg"></image>
- <view class="noTxt">暂无数据</view>
- </view>
- <view class="bottomView">
- <view class="saveCar" @click="addBtn">
- <image src="../../static/img/icon_tianjiacheliang.png" mode=""
- style="width: 44rpx; height: 36rpx; margin-right: 10rpx;"></image>
- <view>添加爱车</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- carList: '',
- loding: false,
- type: '',
- carId: '',
- fromMe: false,
- }
- },
- onLoad(opt) {
- this.$common.isUserId()
- this.type = opt.type;
- // console.log(this.type)
- this.fromMe = opt.fromMe
- },
- onShow() {
- this.getqueryMyBMemberCar();
- this.carId = uni.getStorageSync("maintainCarData").id
- },
- methods: {
- getqueryMyBMemberCar() {
- uni.showLoading({
- title: '加载中'
- })
- this.loding = false;
- this.$http('worldKeepCar/worldHome/queryMyTMemberCar', {
- }, 'GET').then(res => {
- uni.hideLoading();
- this.carList = res.data;
- this.loding = true;
- })
- },
- addBtn() {
- var length = this.carList.length
- if (length > 4) {
- uni.showToast({
- title: '库最多放五辆车,如果想添加,请先删除',
- icon: 'none',
- duration: 3000
- });
- } else {
- uni.navigateTo({
- url: 'addCar'
- })
- }
- },
- editCar(id) {
- uni.navigateTo({
- url: 'addCar?id=' + id + '&isEditCar=true'
- })
- },
- delCar(id) {
- var that = this;
- uni.showModal({
- title: '提示',
- content: '确定要删除车辆吗',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({});
- that.$http('worldKeepCar/worldHome/deleteTMemberCar', {
- id: id
- }, 'POST').then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- if (that.carId == id) {
- uni.removeStorageSync('maintainCarData');
- }
- }
- that.getqueryMyBMemberCar()
- })
- } else if (res.cancel) {
- }
- }
- });
- },
- defaultCar(item) {
- var that = this;
- uni.showLoading({
- title: '保存中'
- })
- that.$http('worldKeepCar/worldHome/updateTCarIsdefault', {
- id: item.id
- }, 'POST').then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- uni.showToast({
- title: '操作成功',
- icon: 'none',
- duration: 3000
- });
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- duration: 3000
- });
- }
- that.getqueryMyBMemberCar()
- })
- },
- itemClick(item) {
- if (this.fromMe == 'true') {
- return
- }
- uni.setStorage({
- key: 'maintainCarData',
- data: item,
- success: function() {
- uni.navigateBack({
- delta: 1
- })
- }
- });
- }
- }
- }
- </script>
- <style scoped>
- .box {
- min-height: 100vh;
- background: #F4F5F7;
- }
- .nodataImg {
- width: 400rpx;
- padding-top: 100rpx;
- }
- .noTxt {
- font-size: 36rpx;
- color: #999999;
- padding-top: 50rpx;
- }
- .nodataBox {
- text-align: center;
- }
- .bottomView {
- background-color: #FFFFFF;
- width: 100%;
- height: 120rpx;
- position: fixed;
- bottom: 0rpx;
- }
- .saveCar {
- background: linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
- margin: 23rpx 30rpx;
- height: 74rpx;
- border-radius: 37rpx;
- color: #FFFFFF;
- font-size: 30rpx;
- font-weight: bold;
- align-items: center;
- display: flex;
- justify-content: center;
- }
- .carlistBox {
- padding-bottom: 120rpx;
- }
- .carlistBox {
- padding: 24rpx;
- padding-bottom: 120rpx;
- }
- .brandLogo {
- width: 63rpx;
- }
- .line {
- background: #FFFFFF;
- padding: 27rpx 20rpx;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- position: relative;
- }
- .lineCont {
- display: flex;
- }
- .carName {
- color: #3C3C3C;
- font-size: 30rpx;
- display: flex;
- }
- .plateNumber {
- border-radius: 4px;
- border: 1px solid #F19D01;
- height: 32rpx;
- line-height: 32rpx;
- padding: 0 10rpx;
- color: #F19D01;
- font-size: 22rpx;
- margin-left: 20rpx;
- margin-top: 5rpx;
-
- }
- .carMS {
- color: #666666;
- font-size: 26rpx;
- padding-top: 5px;
- }
- .lineBottom {
- display: flex;
- justify-content: flex-end;
- padding-top: 20rpx;
- }
- .lineDel {
- width: 94rpx;
- height: 50rpx;
- border-radius: 25rpx;
- border: 1px solid #DDDDDD;
- text-align: center;
- line-height: 50rpx;
- font-size: 26rpx;
- color: #3C3C3C;
- margin-right: 29rpx;
- }
- .Default {
- width: 148rpx;
- height: 50rpx;
- border-radius: 25rpx;
- border: 1px solid #FF4F00;
- line-height: 50rpx;
- text-align: center;
- color: #FF4F00;
- font-size: 26rpx;
- }
- .DefaultYES {
- width: 148rpx;
- height: 50rpx;
- border-radius: 25rpx;
- border: 1px solid #DDDDDD;
- line-height: 50rpx;
- text-align: center;
- color: #999999;
- font-size: 26rpx;
- }
- .DefaultIcon {
- position: absolute;
- top: 0;
- right: 0;
- width: 109rpx;
- height: 40rpx;
- background: linear-gradient(131deg, #FFA72C 0%, #FF450F 100%);
- border-radius: 0px 10rpx 0px 10rpx;
- text-align: center;
- line-height: 40rpx;
- color: #FFFFFF;
- font-size: 22rpx;
- }
- </style>
|