功能完善
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<view class='content'>
|
||||
<scroll-view :scroll-y='true'>
|
||||
<item v-for='(item,index) in addressList' :key='index' :item='item' />
|
||||
<item v-for='(item,index) in addressList' :key='index' :item='item'
|
||||
@on-checked='onChecked(item)'
|
||||
@on-edit='args => goPath(`create?bean=${encodeURIComponent(JSON.stringify(args))}`)'
|
||||
@on-delete='args => {addressDelete(args?.addrid);fetchAddressList}' />
|
||||
</scroll-view>
|
||||
|
||||
<view class='bottom-button-view'>
|
||||
@@ -14,13 +17,17 @@
|
||||
|
||||
import Item from './components/item.vue';
|
||||
import { goPath } from '@/utils';
|
||||
import { getAddressList } from '@/api/user';
|
||||
import { addressDelete, getAddressList } from '@/api/user';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const addressList = ref<{
|
||||
name: string,
|
||||
mobile: string,
|
||||
address: string,
|
||||
status: number
|
||||
addr: string,
|
||||
status: number,
|
||||
defaultstatus: number,
|
||||
}[]>([]);
|
||||
|
||||
onLoad((e) => {
|
||||
@@ -32,8 +39,12 @@ onShow(() => {
|
||||
});
|
||||
|
||||
const fetchAddressList = async () => {
|
||||
const { data } = await getAddressList();
|
||||
addressList.value = data;
|
||||
addressList.value = await getAddressList();
|
||||
};
|
||||
|
||||
const onChecked = (e: any) => {
|
||||
uni.navigateBack();
|
||||
userStore.setDeliveryAddress(e);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user