Browse Source

修复bug

master
longjieli 2 months ago
parent
commit
5832b77acc
4 changed files with 133 additions and 160 deletions
  1. +11
    -3
      otherPages/userManage/pet/components/petBaseInfo.vue
  2. +108
    -120
      otherPages/userManage/pet/components/petHealthInfo.vue
  3. +5
    -28
      otherPages/userManage/pet/index.vue
  4. +9
    -9
      otherPages/userManage/pet/petInfo.vue

+ 11
- 3
otherPages/userManage/pet/components/petBaseInfo.vue View File

@ -10,7 +10,7 @@
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="性别" :prop="`petBaseInfo.sex`" labelWidth="80" borderBottom @click="showSex = true">
<u--input v-model="petBaseInfo.sex" disabled disabledColor="#ffffff" placeholder="请选择"
<u--input v-model="sexText" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
@ -101,7 +101,8 @@
import {
ref,
onMounted,
watch
watch,
computed
} from 'vue';
// props
@ -147,6 +148,14 @@
const tempDisposition = ref('');
const uForm = ref(null);
const item1 = ref(null);
const sexText = computed(() => {
const sexMap = {
0: '男生',
1: '女生'
};
return sexMap[props.petBaseInfo.sex] || '';
});
//
const nameChange = () => {
@ -228,7 +237,6 @@
};
const checkboxChange = (n) => {
console.log('change', n);
updatePetBaseInfo();
};


+ 108
- 120
otherPages/userManage/pet/components/petHealthInfo.vue View File

@ -1,69 +1,54 @@
<template>
<view >
<view class="personal-pet-health-info">
<view class="personal-pet-info-title border-bottom">
宠物健康情况
</view>
<u--form labelPosition="left" :model="petHealthInfo" ref="uForm">
<u-form-item required label="疫苗" :prop="`petHealthInfo.vaccineStatus`" labelWidth="80" borderBottom
@click="showVaccine = true">
<u--input v-model="petHealthInfo.vaccineStatus" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<u-form-item required label="驱虫" :prop="`petHealthInfo.dewormingStatus`" labelWidth="80" borderBottom
@click="showExpelling = true">
<u--input v-model="petHealthInfo.dewormingStatus" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<u-form-item label="绝育" :prop="`petHealthInfo.sterilization`" labelWidth="80" borderBottom
@click="showSterilization = true" ref="item1">
<u--input v-model="petHealthInfo.sterilization" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<u-form-item v-if="petType === 'dog' || petType === '狗狗' " label="狗证" :prop="`petHealthInfo.doglicenseStatus`" labelWidth="80" borderBottom
@click="showDog = true" ref="item1">
<u--input v-model="petHealthInfo.doglicenseStatus" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<view class="dog-tips" v-if="petType === 'dog' || petType === '狗狗'">
<image class="icon" :src="configList.pet_dog_license.paramValueImage"></image>
<view>
<up-parse :content="configList.pet_dog_license.paramValueArea" containerStyle="{
color: '#A94F20',
fontSize: '12px',
}"></up-parse>
</view>
</view>
<u-form-item required label="健康" :prop="`petHealthInfo.healths`" labelWidth="80"
@click="healthsSelect">
<u--input disabled disabledColor="#ffffff" placeholder="请选择(多选)" :value="petHealthInfo.healthStatus && petHealthInfo.healthStatus.join(',')"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<view slot="right">
<u-icon v-if="showHealths" name="arrow-down" color="#AAA"></u-icon>
<u-icon v-else name="arrow-right" color="#AAA" ></u-icon>
</view>
</u-form-item>
</u--form>
</view>
<view class="health-select" v-show="showHealths">
<view style="padding: 10px;height: 85%;">
<u-checkbox-group v-model="petHealthInfo.healthStatus" @change="checkboxChange" placement="column" activeColor="#ffbf60">
<u-checkbox :customStyle="{marginBottom: '8px'}" v-for="(item, index) in healthData"
:key="index" :label="item" :name="item">
</u-checkbox>
</u-checkbox-group>
<u--input placeholder="请输入其他健康特征"
:disabled="!(petHealthInfo.healthStatus && petHealthInfo.healthStatus.includes('其他'))"
border="surround" maxlength='20'
:customStyle="{backgroundColor: '#fff'}"
@change="updatePetHealthInfo()"
v-model="petHealthInfo.remark"></u--input>
</view>
</view>
<view>
<view class="personal-pet-health-info">
<view class="personal-pet-info-title border-bottom">
宠物健康情况
</view>
<u--form labelPosition="left" :model="petHealthInfo" ref="uForm">
<u-form-item required label="疫苗" :prop="`petHealthInfo.vaccine`" labelWidth="80" borderBottom
@click="showVaccine = true">
<u--input v-model="vaccineText" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<u-form-item required label="驱虫" :prop="`petHealthInfo.deworm`" labelWidth="80" borderBottom
@click="showExpelling = true">
<u--input v-model="dewormText" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<u-form-item label="绝育" :prop="`petHealthInfo.neutered`" labelWidth="80" borderBottom
@click="showSterilization = true" ref="item1">
<u--input v-model="neuteredText" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<u-form-item v-if="petType === '1' || petType === '狗狗' " label="狗证" :prop="`petHealthInfo.petCard`"
labelWidth="80" borderBottom @click="showDog = true" ref="item1">
<u--input v-model="petCartText" disabled disabledColor="#ffffff" placeholder="请选择"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-right" color="#AAA"></u-icon>
</u-form-item>
<view class="dog-tips" v-if="petType === 'dog' || petType === '狗狗'">
<u-icon name="info-circle" color="#A94F20" size="12"></u-icon>
<view style="margin-left: 3px;">
未办理养犬许可证且需要外出遛狗, 犬只存在被相关单位收缴
甚至捕杀的可能请您遵守当地养犬规范合法文明养犬具体
请您查看当地养犬条例
</view>
</view>
<!-- 赶进度先注释 -->
<!-- <u-form-item required label="健康" :prop="`petHealthInfo.healths`" labelWidth="80" @click="healthsSelect"> -->
<u-form-item required label="健康" :prop="`petHealthInfo.health`" labelWidth="80">
<u--input disabledColor="#ffffff" placeholder="请输入" v-model="petHealthInfo.health"
placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"></u--input>
<view slot="right">
<u-icon v-if="showHealths" name="arrow-down" color="#AAA"></u-icon>
<u-icon v-else name="arrow-right" color="#AAA"></u-icon>
</view>
</u-form-item>
</u--form>
</view>
<!-- 赶进度先注释 -->
<!-- <view class="health-select" v-show="showHealths">
@ -82,30 +67,23 @@
</view> -->
<u-picker :show="showVaccine" :showToolbar='false' :columns="vaccineActions" @cancel="showVaccine = false"
:immediateChange="true" :defaultIndex="defaultVaccine" @change="vaccineSelect"></u-picker>
:immediateChange="true" @change="vaccineSelect"></u-picker>
<u-picker :show="showExpelling" :showToolbar='false' :columns="expellingActions" @cancel="showExpelling = false"
:immediateChange="true" :defaultIndex="defaultDeworming" @change="expellingSelect"></u-picker>
:immediateChange="true" @change="expellingSelect"></u-picker>
<u-picker :show="showSterilization" :showToolbar='false' :columns="sterilizationActions"
@cancel="showSterilization = false" :immediateChange="true" :defaultIndex="defaultSterilization"
@change="sterilizationSelect"></u-picker>
@cancel="showSterilization = false" :immediateChange="true" @change="sterilizationSelect"></u-picker>
<u-picker :show="showDog" :showToolbar='false' :columns="dogActions" @cancel="showDog = false"
:immediateChange="true" :defaultIndex="defaultDoglicense" @change="dogSelect"></u-picker>
:immediateChange="true" @change="dogSelect"></u-picker>
</view>
</template>
<script setup>
import {
ref,
computed,
onMounted,
watch,
computed
} from 'vue';
import { useStore } from 'vuex'
const store = useStore()
const configList = computed(() => {
return store.getters.configList
})
// props
const props = defineProps({
@ -119,26 +97,10 @@
vaccine: '',
deworm: '',
neutered: '',
doglicenseStatus: '',
petCard: '',
health: [],
remark: ''
})
},
defaultVaccine: {
type: Number,
default: 0
},
defaultDeworming: {
type: Number,
default: 0
},
defaultSterilization: {
type: Number,
default: 0
},
defaultDoglicense: {
type: Number,
default: 0
}
});
@ -168,6 +130,37 @@
const uForm = ref(null);
const item1 = ref(null);
const vaccineText = computed(() => {
const vaccineMap = {
0: '每年都免疫',
1: '有免疫史',
2: '未免疫'
};
return vaccineMap[props.petHealthInfo.vaccine] || ''
});
const dewormText = computed(() => {
const dewormMap = {
0: '未驱虫',
1: '定期驱虫',
2: '有驱虫史'
};
return dewormMap[props.petHealthInfo.deworm] || ''
});
const neuteredText = computed(() => {
const neuteredMap = {
0: '已绝育',
1: '未绝育'
};
return neuteredMap[props.petHealthInfo.neutered] || ''
});
const petCartText = computed(() => {
const petCartMap = {
0: '是',
1: '否'
};
return petCartMap[props.petHealthInfo.petCard] || ''
});
//
const getHealthDataList = () => {
// getDictList('pet_health_status').then(res => {
@ -201,7 +194,7 @@
};
const dogSelect = (e) => {
props.petHealthInfo.doglicenseStatus = e.value[0];
props.petHealthInfo.petCard = e.index;
showDog.value = false;
updatePetHealthInfo();
};
@ -215,7 +208,6 @@
};
const checkboxChange = (n) => {
console.log('change', n);
updatePetHealthInfo();
};
@ -240,26 +232,22 @@
</script>
<style lang="scss">
.personal-pet-health-info{
background-color: #fff;
padding: 10px 20px 0 20px;
margin-top: 10px;
}
.health-select{
background-color: #fffcf2;
padding: 10px 20px;
}
.dog-tips{
color: #A94F20;
font-size: 12px;
display: flex;
align-items: baseline;
margin-top: 5px;
.icon {
width: 12px;
height: 12px;
margin-right: 3px;
}
}
</style>
.personal-pet-health-info {
background-color: #fff;
padding: 10px 20px 0 20px;
margin-top: 10px;
}
.health-select {
background-color: #fffcf2;
padding: 10px 20px;
}
.dog-tips {
color: #A94F20;
font-size: 12px;
display: flex;
align-items: baseline;
margin-top: 5px;
}
</style>

+ 5
- 28
otherPages/userManage/pet/index.vue View File

@ -66,8 +66,8 @@
</view>
<view>
<u-picker :showToolbar='true' :show="show" :columns="petTypes" @change="petTypeChange" @cancel="cancel"
@confirm="confirm" :immediateChange="true"></u-picker>
<u-picker :showToolbar='false' :show="show" :columns="petTypes" @change="petTypeChange" @cancel="cancel"
:immediateChange="true"></u-picker>
</view>
<u-modal :show="showDel" @confirm="confirmDel" @cancel="cancelDel" ref="uModal" showCancelButton
@ -147,9 +147,6 @@
const petTypeChange = (e) => {
petType.value = e.value[0];
};
const confirm = (e) => {
show.value = false;
if (petType.value === '猫咪') {
uni.navigateTo({
@ -161,30 +158,9 @@
url: "/otherPages/userManage/pet/petInfo?petType=1&optionType=add"
})
}
// if (!petType.value) {
// if (e.value[0] === '') {
// router.push({
// path: `/pages/personalCenter/petInfo`,
// query: {
// petType: 'cat',
// optionType: 'add'
// }
// });
// }
// if (e.value[0] === '') {
// router.push({
// path: `/pages/personalCenter/petInfo`,
// query: {
// petType: 'dog',
// optionType: 'add'
// }
// });
// }
// }
};
const editPet = (item) => {
console.log(item)
if (item.petType === '猫咪' || item.petType === 0) {
uni.navigateTo({
url: `/otherPages/userManage/pet/petInfo?petType=0&optionType=edit&petId=${item.id}`
@ -205,8 +181,9 @@
const confirmDel = async () => {
try {
await delByPetId({ id : deleteId.value });
console.log('删除成功');
await delByPetId({
id: deleteId.value
});
getPetList();
} catch (error) {
console.error('删除宠物失败', error);


+ 9
- 9
otherPages/userManage/pet/petInfo.vue View File

@ -19,7 +19,7 @@
<view class="personal-pet-info-btns">
<view class="personal-pet-btns">
<view class="personal-pet-btn">
<u-button :disabled="optionType!='edit'" color="#FFF4E4" @click="cancelPet">
<u-button color="#FFF4E4" @click="cancelPet">
<view style="color: #A9A9A9;">
取消
</view>
@ -84,7 +84,7 @@
vaccine: '',
deworm: '',
neutered: '',
doglicenseStatus: '',
petCard: '',
health: '',
remark: ''
});
@ -152,7 +152,9 @@
};
const getPetDetailsFunc = (petId) => {
getPetDetails({ id : petId }).then((res) => {
getPetDetails({
id: petId
}).then((res) => {
if (res.code == 200) {
const {
headImage,
@ -165,7 +167,7 @@
vaccine,
deworm,
neutered,
doglicenseStatus,
petCard,
health,
remark
} = res.data;
@ -177,12 +179,11 @@
birthday,
personality
};
petHealthInfo.value = {
vaccine,
deworm,
neutered,
doglicenseStatus,
petCard,
health,
remark
};
@ -217,7 +218,6 @@
...petBaseInfo.value,
...petHealthInfo.value
};
if (!params.nickName) {
uni.showToast({
title: '请填写宠物昵称!',
@ -250,7 +250,7 @@
});
return;
}
if (!params.vaccine) {
if (!(params.vaccine >= 0)) {
uni.showToast({
title: '请选择宠物疫苗情况!',
duration: 3000,
@ -258,7 +258,7 @@
});
return;
}
if (!params.deworm) {
if (!(params.deworm >= 0)) {
uni.showToast({
title: '请选择宠物驱虫情况!',
duration: 3000,


Loading…
Cancel
Save