diff --git a/api/amount/index.js b/api/amount/index.js index f4b933b..fa3acb7 100644 --- a/api/amount/index.js +++ b/api/amount/index.js @@ -26,13 +26,13 @@ export const cashIn = (data) => { } // 小程序-提现 -export const cashOut = (params) => { +export const cashOut = (data) => { return request({ - url: '/app', + url: '/applet/amount/cashOut', headers: { isToken: true }, - method: "get", - params + method: "post", + data }) } \ No newline at end of file diff --git a/api/pet/index.js b/api/pet/index.js index 6043e8f..3274d5d 100644 --- a/api/pet/index.js +++ b/api/pet/index.js @@ -1,7 +1,7 @@ import request from '@/utils/request' // 查询我的宠物列表 -export function petList() { +export function getpetList() { return request({ headers: { "isToken": true @@ -10,3 +10,63 @@ export function petList() { method: 'get' }) } + +// 根据宠物标识查询宠物信息 +export function getByPetId(params) { + return request({ + headers: { + "isToken": true + }, + url: "/applet/pet/getByPetId", + method: 'get', + params + }) +} + +// 根据宠物标识删除宠物信息 +export function delByPetId(params) { + return request({ + headers: { + "isToken": true + }, + url: "/applet/pet/getByPetId", + method: 'get', + params + }) +} + +// 新增宠物信息 +export function addPet(data) { + return request({ + headers: { + "isToken": true + }, + url: "/applet/pet/getByPetId", + method: 'post', + data + }) +} + +// 更新宠物信息 +export function updatePet(data) { + return request({ + headers: { + "isToken": true + }, + url: "/applet/pet/getByPetId", + method: 'post', + data + }) +} + +// 获取宠物详情 +export function getPetDetails(params) { + return request({ + headers: { + "isToken": true + }, + url: "/applet/pet/getByPetId", + method: 'get', + params + }) +} \ No newline at end of file diff --git a/otherPages/myOrdersManage/bond/index.vue b/otherPages/myOrdersManage/bond/index.vue index cb09b3c..264ff4e 100644 --- a/otherPages/myOrdersManage/bond/index.vue +++ b/otherPages/myOrdersManage/bond/index.vue @@ -83,6 +83,12 @@ type: 1, userId: userInfo.value.userId }) + if (response.code == 200) { + uni.showToast({ + title: response.msg, + icon: "none" + }) + } } diff --git a/otherPages/myOrdersManage/transaction/index.vue b/otherPages/myOrdersManage/transaction/index.vue index ee3564c..35e187c 100644 --- a/otherPages/myOrdersManage/transaction/index.vue +++ b/otherPages/myOrdersManage/transaction/index.vue @@ -2,14 +2,16 @@ - + 收入明细 - + 支出明细 - + \ No newline at end of file diff --git a/otherPages/userManage/pet/components/petHealthInfo.vue b/otherPages/userManage/pet/components/petHealthInfo.vue new file mode 100644 index 0000000..964f092 --- /dev/null +++ b/otherPages/userManage/pet/components/petHealthInfo.vue @@ -0,0 +1,226 @@ + + + + + \ No newline at end of file diff --git a/otherPages/userManage/pet/index.vue b/otherPages/userManage/pet/index.vue index bad92f4..ca59071 100644 --- a/otherPages/userManage/pet/index.vue +++ b/otherPages/userManage/pet/index.vue @@ -1,12 +1,12 @@ @@ -50,78 +79,201 @@ ref, onMounted } from 'vue'; + // import { + // getDictList + // } from "@/api/system/user.js" import { - petList + getpetList, + delByPetId } from "@/api/pet/index.js"; + import { + useRouter + } from 'vue-router'; import { onShow, onPullDownRefresh - } from "@dcloudio/uni-app" + } from '@dcloudio/uni-app' + - // 定义响应式数据 + const router = useRouter(); const defaultPhoto = ref('https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/catdog.png'); - const petLists = ref([]); + const petList = ref([]); + const show = ref(false); + const showDel = ref(false); + const petTypes = ref([]); + const delContent = ref(''); const deleteId = ref(''); const petType = ref(''); - // 获取宠物列表 - const getPetListData = async () => { - petLists.value = []; + const getPetList = async () => { + petList.value = []; try { - const res = await petList(); + const res = await getpetList(); if (res && res.data) { - petLists.value = res.data; + petList.value = res.data; + showDel.value = false; } } catch (error) { console.error('获取宠物列表失败', error); } }; - // 添加宠物 + // const getPetTypeList = async () => { + // try { + // const res = await getDictList('pet_type'); + // if (res.code === 200) { + // const petType = res.data.map(e => e.dictLabel); + // petTypes.value = [petType]; + // } else { + // console.error('获取pet type失败'); + // } + // } catch (error) { + // console.error('获取pet type列表失败', error); + // } + // }; + const addPet = () => { - show.value = true; + uni.navigateTo({ + url: "/otherPages/userManage/pet/petInfo" + }) + }; + + const cancel = () => { + show.value = false; + }; + + const petTypeChange = (e) => { + petType.value = e.value[0]; + }; + + const confirm = (e) => { + show.value = false; + console.log(petType.value); + if (petType.value === '猫猫') { + router.push({ + path: `/pages/personalCenter/petInfo`, + query: { + petType: 'cat', + optionType: 'add' + } + }); + } + if (petType.value === '狗狗') { + router.push({ + path: `/pages/personalCenter/petInfo`, + query: { + petType: 'dog', + 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) => { if (item.petType === '猫猫' || item.petType === 'cat') { - uni.navigateTo({ - url: `/pages/personalCenter/petInfo?petType=cat&optionType=edit&petId=${item.id}` + router.push({ + path: `/pages/personalCenter/petInfo`, + query: { + petType: 'cat', + optionType: 'edit', + petId: item.id + } }); } if (item.petType === '狗狗' || item.petType === 'dog') { - uni.navigateTo({ - url: `/pages/personalCenter/petInfo?petType=dog&optionType=edit&petId=${item.id}` + router.push({ + path: `/pages/personalCenter/petInfo`, + query: { + petType: 'dog', + optionType: 'edit', + petId: item.id + } }); } }; - // 删除宠物 const deletePet = (item) => { + delContent.value = "确定要删除" + item.name + '?'; showDel.value = true; deleteId.value = item.id; }; - // 生命周期钩子 + const confirmDel = async () => { + try { + await delByPetId(deleteId.value); + console.log('删除成功'); + getPetList(); + } catch (error) { + console.error('删除宠物失败', error); + } + }; + + const cancelDel = () => { + showDel.value = false; + deleteId.value = ''; + }; + onMounted(() => { - getPetListData(); + // getPetTypeList(); + getPetList(); }); onShow(() => { - getPetListData(); + getPetList(); }); onPullDownRefresh(() => { - getPetListData(); + getPetList(); }); - \ No newline at end of file diff --git a/otherPages/userManage/pet/petInfo.vue b/otherPages/userManage/pet/petInfo.vue new file mode 100644 index 0000000..bab81b6 --- /dev/null +++ b/otherPages/userManage/pet/petInfo.vue @@ -0,0 +1,447 @@ + + + + + \ No newline at end of file diff --git a/pages.json b/pages.json index d6c42fc..dece7e7 100644 --- a/pages.json +++ b/pages.json @@ -362,6 +362,12 @@ "style": { "navigationBarTitleText": "我的宠物" } + }, + { + "path": "pet/petInfo", + "style": { + "navigationBarTitleText": "创建宠物档案" + } } ] } diff --git a/pages/myOrdersManage/components/systemOrder.vue b/pages/myOrdersManage/components/systemOrder.vue index 7b71c86..cac51ea 100644 --- a/pages/myOrdersManage/components/systemOrder.vue +++ b/pages/myOrdersManage/components/systemOrder.vue @@ -1,8 +1,7 @@ @@ -90,6 +90,10 @@ current.value = item.index; getOrderList(); } + + const updateList = () => { + getOrderList(); + }