Browse Source

修改问题

master
396316021 1 year ago
parent
commit
fbee79cf92
  1. 30
      components/PetPage/index.vue

30
components/PetPage/index.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="pet-page-container" :style="{width:buttonWidth}" v-if="type === 'create'"> <view class="pet-page-container" :style="{width:buttonWidth}" v-if="typeData === 'create'">
<view class="pet-page-capsule-container row"> <view class="pet-page-capsule-container row">
<view class="pet-page-capsule col-4" v-for="(item,index) in petTypeList" <view class="pet-page-capsule col-4" v-for="(item,index) in petTypeList"
:class="{active:(item.value === data.type)}" @click="selectPetType(item.value)"> :class="{active:(item.value === data.type)}" @click="selectPetType(item.value)">
@ -7,7 +7,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="pet-page-group row" v-if="type === 'create'"> <view class="pet-page-group row" v-if="typeData === 'create'">
<view class="order-item row"> <view class="order-item row">
<view class="item-title"> <view class="item-title">
<text style="color: red;">*</text>宝贝姓名 <text style="color: red;">*</text>宝贝姓名
@ -288,7 +288,7 @@
</view> </view>
</view> </view>
<view class="pet-list" v-if="type === 'lists'"> <view class="pet-list" v-if="typeData === 'lists'">
<view class="order-screen-container row"> <view class="order-screen-container row">
<view class="order-list-container"> <view class="order-list-container">
<view class="order-list-item" v-for="(item,index) in petCheckList"> <view class="order-list-item" v-for="(item,index) in petCheckList">
@ -331,7 +331,7 @@
</view> </view>
<view class="pet-page-button row"> <view class="pet-page-button row">
<view class="col-6" style="justify-content: center;" v-if="type === 'lists'"> <view class="col-6" style="justify-content: center;" v-if="typeData === 'lists'">
<view class="" style="display: inline-block;"> <view class="" style="display: inline-block;">
<MzButton <MzButton
title="选择萌宠" title="选择萌宠"
@ -344,7 +344,7 @@
</MzButton> </MzButton>
</view> </view>
</view> </view>
<view class="col-6" style="justify-content: center;" v-if="type === 'lists'"> <view class="col-6" style="justify-content: center;" v-if="typeData === 'lists'">
<view class="" style="display: inline-block;"> <view class="" style="display: inline-block;">
<MzButton <MzButton
title="添加萌宠" title="添加萌宠"
@ -352,23 +352,23 @@
font-color="#fff" font-color="#fff"
button-width="300rpx" button-width="300rpx"
class="" class=""
@click="type = 'create'" @click="typeData = 'create'"
> >
</MzButton> </MzButton>
</view> </view>
</view> </view>
<view class="col-6" v-if="type === 'create' && showCancel"> <view class="col-6" v-if="typeData === 'create' && showCancel">
<MzButton <MzButton
title="取消" title="取消"
button-color="#FFFFFF" button-color="#FFFFFF"
font-color="#262626" font-color="#262626"
button-width="300rpx" button-width="300rpx"
class="" class=""
@click="type = 'lists'" @click="typeData = 'lists'"
> >
</MzButton> </MzButton>
</view> </view>
<view class="col-6" v-if="type === 'create'"> <view class="col-6" v-if="typeData === 'create'">
<MzButton <MzButton
title="保存" title="保存"
button-color="#4DC3B8" button-color="#4DC3B8"
@ -608,7 +608,7 @@
}, },
autoBack:{ autoBack:{
type:Boolean, type:Boolean,
default:false, default:true,
}, },
petId:{ petId:{
type:Number, type:Number,
@ -620,6 +620,7 @@
}, },
data() { data() {
return { return {
typeData: this.type,
petList:[], petList:[],
petCheckList:[], petCheckList:[],
status:'loadmore', status:'loadmore',
@ -683,7 +684,7 @@
if(this.petId!==0){ if(this.petId!==0){
this.getDetail(this.petId) this.getDetail(this.petId)
} }
if(this.type === 'lists'){ if(this.typeData === 'lists'){
this.getMyPets() this.getMyPets()
} }
}, },
@ -933,7 +934,12 @@
}).join(','); }).join(',');
editPet(this.data).then(res => { editPet(this.data).then(res => {
api.success('添加成功'); api.success('添加成功');
uni.navigateBack(); if(this.autoBack){
uni.navigateBack();
}else{
this.typeData = 'lists';
this.getMyPets();
}
}) })
} }
} }

Loading…
Cancel
Save