Commit 9009778b authored by 刘玉宏's avatar 刘玉宏

adderss

parent b490ef64
import { request } from '../utils/request';
export function groupBuyList() {
return request({
url: '/sgyrdd/category/groupBuyList',
method: 'GET',
});
}
// 新增收货地址
export async function addAddress() {
return request({
url: '/sgyrdd/useraddr/add',
method: 'GET',
});
}
// 修改收货地址
export async function updateAddress() {
return request({
url: '/sgyrdd/useraddr/update',
method: 'GET',
});
}
// 删除收货地址
export async function deleteAddress(addrId) {
return request({
url: `/sgyrdd/useraddr/delete/${addrId}`,
method: 'GET',
});
}
// 查询收货地址列表
export async function getAddressList() {
return request({
url: '/sgyrdd/useraddr/list',
method: 'GET',
});
}
......@@ -108,10 +108,10 @@ function fieldNotEmpty(val) {
return false;
}
}
const submit=async()=>{
const res=await addAddress(model.value);
const submit = async () => {
const res = await addAddress(model.value);
console.log(res);
}
};
function handleSubmit() {
form.value
.validate()
......
......@@ -7,41 +7,21 @@
<img src="@/static/address/address.png" />
<wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button>
</view>
<view class="full_list" v-else>
<view class="additem">
<view class="additem_l">
<view class="address">这是地址这是地址这是地址这是地址这是地 址这是地址这是地址</view>
<view class="info">
<view class="name">这是姓名</view>
<view class="phone">123456789258</view>
</view>
<view class="address_status">
<view v-if="mainAddFlag" class="box active">
<wd-icon name="check-circle-filled" size="12px"></wd-icon>
<view class="txt">默认</view>
</view>
<view v-else class="box">
<wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">默认</view>
</view>
</view>
</view>
<view class="additem_r">
<wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon>
</view>
</view>
<view class="additem">
<view class="additem" v-for="(item, index) in addressList" :key="index">
<view class="additem_l">
<view class="address">这是地址这是地址这是地址这是地址这是地 址这是地址这是地址</view>
<view class="address">{{ item.addr }}</view>
<view class="info">
<view class="name">这是姓名</view>
<view class="phone">123456789258</view>
<view class="name">{{ item.receiver }}</view>
<view class="phone">{{ item.mobile }}</view>
</view>
<view class="address_status">
<view v-if="mainAddFlag" class="box active">
<view v-if="item.commonAddr === 1" class="box active">
<wd-icon name="check-circle-filled" size="12px"></wd-icon>
<view class="txt">默认</view>
</view>
<view v-else class="box">
<wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">默认</view>
......@@ -52,6 +32,7 @@
<wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon>
</view>
</view>
<wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button>
</view>
</view>
......@@ -60,9 +41,23 @@
<script setup>
import Header from '@/pages/order/components/Header/index.vue';
const fileDomain = import.meta.env.VITE_APP_IMG_URL;
import { getAddressList, deleteAddress } from '@/api/address';
const isAdressEmpty = ref(false);
const mainAddFlag = ref(false);
const addressList = ref([]);
const getAddressListData = async () => {
const { data: res } = await getAddressList();
console.log(res);
if (res) {
addressList.value = res;
res.length === 0 ? (isAdressEmpty.value = true) : (isAdressEmpty.value = false);
}
};
getAddressListData();
const addNewAddress = () => {
xma.navigateTo({ url: '/pages/address/addressEdit?new=true' });
......@@ -97,6 +92,7 @@ page {
.full_list {
margin-top: 20rpx;
.additem {
width: 710rpx;
padding: 20rpx;
......@@ -109,17 +105,20 @@ page {
font-family: Source Han Sans;
font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on;
.additem_l {
width: 600rpx;
display: flex;
flex-direction: column;
}
.additem_r {
flex: 1;
padding-top: 30rpx;
box-sizing: border-box;
text-align: right;
}
.address {
font-size: 24rpx;
font-weight: 500;
......@@ -136,6 +135,7 @@ page {
color: #abaaaa;
display: flex;
margin-bottom: 30rpx;
.phone {
margin-left: 10rpx;
}
......@@ -146,11 +146,13 @@ page {
display: flex;
font-size: 18rpx;
align-items: center;
.txt {
margin-left: 5rpx;
color: #abaaaa;
}
}
.box.active {
color: #fa5151;
}
......@@ -172,12 +174,13 @@ page {
.empty_list {
margin-top: 20rpx;
img {
width: 566rpx;
height: 566rpx;
margin: 40rpx auto 60rpx;
display: block;
border: 1px dashed rgb(182, 182, 182);
// border: 1px dashed rgb(182, 182, 182);
}
.addBtn {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment