调试接口
This commit is contained in:
@ -26,45 +26,19 @@
|
||||
<view class="text-28rpx leading-40rpx text-[#8A94A3] mt-18rpx">还没有地址,请尽快新建地址</view>
|
||||
</view>
|
||||
|
||||
<!-- <wd-radio-group v-model="addressId" shape="button" >
|
||||
<wd-radio :value="1">沃特</wd-radio>
|
||||
<wd-radio :value="2">商家后台</wd-radio>
|
||||
</wd-radio-group> -->
|
||||
|
||||
<!-- 地址列表 -->
|
||||
<!-- <view class="mx-30rpx mt-20rpx" v-if="addressList.length > 0">
|
||||
<view class="bg-#fff rounded-16rpx px-30rpx py-36rpx flex items-center mb-20rpx" v-for="(item, index) in addressList" :key="index">
|
||||
<view @click="List.handleChooseAddress(item)">
|
||||
<view class="flex items-center">
|
||||
<view class="mr-10rpx">
|
||||
<wd-tag color="#4C9F44" bg-color="#F3F3F3" custom-class="!rounded-4rpx !px-10rpx" v-if="item.is_default">默认</wd-tag>
|
||||
</view>
|
||||
<view class="text-30rpx leading-42rpx text-#303133">
|
||||
<text class="mr-16rpx">{{ item.contact}}</text>
|
||||
<text>{{ item.telephone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-562rpx line-1 text-26rpx leading-34rpx text-#909399 mt-10rpx">{{ item.address }}</view>
|
||||
</view>
|
||||
<view class="flex-1 ml-30rpx" @click="List.handleEditAddress(item.id)">
|
||||
<wd-icon name="edit-outline" size="32rpx" color="#666666"></wd-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="mx-30rpx mt-38rpx address-radio">
|
||||
<wd-radio-group v-model="addressId" shape="dot" >
|
||||
<view class="bg-white rounded-16rpx px-40rpx py-30rpx mb-20rpx" v-for="item in addressList" :key="item.id">
|
||||
<view class="bg-white rounded-16rpx px-40rpx py-30rpx mb-20rpx" v-for="(item, index) in addressList" :key="item.id">
|
||||
<view class="">
|
||||
<wd-radio :value="item.id" checked-color="#4C9F44">
|
||||
<view class="flex items-center">
|
||||
<wd-img :src="`${OSS}icon/icon_location5.png`" width="40rpx" height="40rpx"></wd-img>
|
||||
<view class="ml-16rpx text-30rpx leading-42rpx text-[#303133]">位置1</view>
|
||||
<view class="ml-16rpx text-30rpx leading-42rpx text-[#303133]">位置{{ index + 1 }}</view>
|
||||
</view>
|
||||
</wd-radio>
|
||||
</view>
|
||||
<view class="line-2 text-26rpx leading-34rpx text-[#606266] mt-16rpx">
|
||||
北京市海淀区恒大新宏福苑西区20号楼2单元301
|
||||
{{ item.address }}
|
||||
</view>
|
||||
|
||||
<view class="flex items-center justify-end mt-24rpx text-26rpx leading-34rpx text-[##303133]">
|
||||
@ -99,9 +73,12 @@
|
||||
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 { useToast } from 'wot-design-uni'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
const from = ref<string>('')
|
||||
const toast = useToast()
|
||||
|
||||
// 弹出框
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
@ -111,24 +88,14 @@
|
||||
|
||||
// 选中的地址ID
|
||||
const addressId = ref<number>(0)
|
||||
|
||||
const addressList = ref<Array<{id:number, address: string}>>([
|
||||
{
|
||||
id: 1,
|
||||
address: '浙江省杭州市西湖区文三路138号',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
address: '浙江省杭州市西湖区文三路138号',
|
||||
}
|
||||
])
|
||||
const addressList = ref<Array<{id:number, address: string}>>([])
|
||||
|
||||
onLoad((args) => {
|
||||
if (args.from) {
|
||||
from.value = args.from as string
|
||||
}
|
||||
|
||||
// 监听地址列表刷新
|
||||
// 监听地址列表刷新
|
||||
uni.$on('refreshAddressList', () => {
|
||||
List.handleInit()
|
||||
})
|
||||
@ -146,8 +113,8 @@
|
||||
* 初始化地址列表
|
||||
*/
|
||||
handleInit: async () => {
|
||||
const res = await getUserAddress()
|
||||
addressList.value = Array.isArray(res) ? res : []
|
||||
const res = await getUserAddressList()
|
||||
addressList.value = res
|
||||
},
|
||||
|
||||
/**
|
||||
@ -185,17 +152,11 @@
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then(async (res) => {
|
||||
// // 点击确认按钮回调事件
|
||||
// await deleteUserAddress({
|
||||
// id: addressId.value
|
||||
// })
|
||||
// toast.info('删除成功')
|
||||
// uni.$emit('refreshAddressList')
|
||||
// router.navigateBack(500)
|
||||
}).catch((res) => {
|
||||
console.log("🚀 ~ res2:", res)
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
// 点击确认按钮回调事件
|
||||
await deleteUserAddress(id)
|
||||
toast.show('删除成功')
|
||||
List.handleInit()
|
||||
}).catch((res) => { })
|
||||
},
|
||||
|
||||
/**
|
||||
@ -208,7 +169,7 @@
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $cz-page-background;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user