调试接口
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="pb-200rpx">
|
||||
<!-- 消息弹窗 -->
|
||||
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
||||
|
||||
@ -55,11 +55,10 @@
|
||||
class="fixed bottom-70rpx left-0 right-0 bg-#4C9F44 text-#fff font-bold text-30rpx leading-42rpx mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx"
|
||||
@click="router.navigateTo('/bundle/address/add')">新建地址</view> -->
|
||||
|
||||
<view
|
||||
class="bg-white fixed left-0 right-0 bottom-0 h-152rpx flex items-center px-30rpx"
|
||||
@click="router.navigateTo('/bundle/address/add')">
|
||||
<view class="bg-white fixed left-0 right-0 bottom-0 h-152rpx flex items-center px-30rpx">
|
||||
|
||||
<view v-if="addressList.length == 0" class="w-630rpx bg-#4C9F44 text-#fff font-bold text-30rpx leading-42rpx mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx" @click="router.navigateTo('/bundle/address/add')">新建地址</view>
|
||||
|
||||
<view v-if="addressList.length == 0" class="w-630rpx bg-#4C9F44 text-#fff font-bold text-30rpx leading-42rpx mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx">新建地址</view>
|
||||
<view class="flex items-center justify-between w-full" v-if="addressList.length > 0">
|
||||
<view class="w-330rpx bg-[#F6F7F8] text-[#303133] h-90rpx text-center leading-90rpx rounded-8rpx" @click="router.navigateTo('/bundle/address/add')">新建地址</view>
|
||||
<view class="w-330rpx bg-[#4C9F44] text-[#FFFFFF] h-90rpx text-center leading-90rpx rounded-8rpx" @click="List.handleUpdateLocation">位置更新</view>
|
||||
@ -73,7 +72,7 @@
|
||||
import type { IUserAddressListResult } from '@/api/types/user'
|
||||
import { router } from '@/utils/tools'
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import { getUserAddressList, deleteUserAddress } from '@/api/user'
|
||||
import { getUserAddressList, deleteUserAddress, updateUserAddressLocation } from '@/api/user'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
@ -88,7 +87,7 @@
|
||||
|
||||
// 选中的地址ID
|
||||
const addressId = ref<number>(0)
|
||||
const addressList = ref<Array<{id:number, address: string}>>([])
|
||||
const addressList = ref<Array<{id:number, address: string, status: number}>>([])
|
||||
|
||||
onLoad((args) => {
|
||||
if (args.from) {
|
||||
@ -115,6 +114,7 @@
|
||||
handleInit: async () => {
|
||||
const res = await getUserAddressList()
|
||||
addressList.value = res
|
||||
addressId.value = addressList.value.filter(item => item.status === 1)[0]?.id || 0
|
||||
},
|
||||
|
||||
/**
|
||||
@ -122,7 +122,7 @@
|
||||
* @param id 地址ID
|
||||
*/
|
||||
handleEditAddress: (id: number) => {
|
||||
router.navigateTo(`/bundle_b/pages/tea-specialist/address/add?id=${id}`)
|
||||
router.navigateTo(`/bundle/address/add?id=${id}`)
|
||||
},
|
||||
|
||||
/**
|
||||
@ -162,8 +162,14 @@
|
||||
/**
|
||||
* 更新位置
|
||||
*/
|
||||
handleUpdateLocation: () => {
|
||||
handleUpdateLocation: async () => {
|
||||
if (addressId.value === 0) {
|
||||
toast.show('请选择地址')
|
||||
return
|
||||
}
|
||||
|
||||
const res = await updateUserAddressLocation(addressId.value)
|
||||
toast.show('更新成功')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user