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) { ...@@ -108,10 +108,10 @@ function fieldNotEmpty(val) {
return false; return false;
} }
} }
const submit=async()=>{ const submit = async () => {
const res=await addAddress(model.value); const res = await addAddress(model.value);
console.log(res); console.log(res);
} };
function handleSubmit() { function handleSubmit() {
form.value form.value
.validate() .validate()
......
...@@ -7,41 +7,21 @@ ...@@ -7,41 +7,21 @@
<img src="@/static/address/address.png" /> <img src="@/static/address/address.png" />
<wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button> <wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button>
</view> </view>
<view class="full_list" v-else> <view class="full_list" v-else>
<view class="additem"> <view class="additem" v-for="(item, index) in addressList" :key="index">
<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_l"> <view class="additem_l">
<view class="address">这是地址这是地址这是地址这是地址这是地 址这是地址这是地址</view> <view class="address">{{ item.addr }}</view>
<view class="info"> <view class="info">
<view class="name">这是姓名</view> <view class="name">{{ item.receiver }}</view>
<view class="phone">123456789258</view> <view class="phone">{{ item.mobile }}</view>
</view> </view>
<view class="address_status"> <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> <wd-icon name="check-circle-filled" size="12px"></wd-icon>
<view class="txt">默认</view> <view class="txt">默认</view>
</view> </view>
<view v-else class="box"> <view v-else class="box">
<wd-icon name="circle1" size="12px"></wd-icon> <wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">默认</view> <view class="txt">默认</view>
...@@ -52,6 +32,7 @@ ...@@ -52,6 +32,7 @@
<wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon> <wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon>
</view> </view>
</view> </view>
<wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button> <wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button>
</view> </view>
</view> </view>
...@@ -60,9 +41,23 @@ ...@@ -60,9 +41,23 @@
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; 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 isAdressEmpty = ref(false);
const mainAddFlag = 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 = () => { const addNewAddress = () => {
xma.navigateTo({ url: '/pages/address/addressEdit?new=true' }); xma.navigateTo({ url: '/pages/address/addressEdit?new=true' });
...@@ -97,6 +92,7 @@ page { ...@@ -97,6 +92,7 @@ page {
.full_list { .full_list {
margin-top: 20rpx; margin-top: 20rpx;
.additem { .additem {
width: 710rpx; width: 710rpx;
padding: 20rpx; padding: 20rpx;
...@@ -109,17 +105,20 @@ page { ...@@ -109,17 +105,20 @@ page {
font-family: Source Han Sans; font-family: Source Han Sans;
font-variation-settings: 'opsz' auto; font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on; font-feature-settings: 'kern' on;
.additem_l { .additem_l {
width: 600rpx; width: 600rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.additem_r { .additem_r {
flex: 1; flex: 1;
padding-top: 30rpx; padding-top: 30rpx;
box-sizing: border-box; box-sizing: border-box;
text-align: right; text-align: right;
} }
.address { .address {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
...@@ -136,6 +135,7 @@ page { ...@@ -136,6 +135,7 @@ page {
color: #abaaaa; color: #abaaaa;
display: flex; display: flex;
margin-bottom: 30rpx; margin-bottom: 30rpx;
.phone { .phone {
margin-left: 10rpx; margin-left: 10rpx;
} }
...@@ -146,11 +146,13 @@ page { ...@@ -146,11 +146,13 @@ page {
display: flex; display: flex;
font-size: 18rpx; font-size: 18rpx;
align-items: center; align-items: center;
.txt { .txt {
margin-left: 5rpx; margin-left: 5rpx;
color: #abaaaa; color: #abaaaa;
} }
} }
.box.active { .box.active {
color: #fa5151; color: #fa5151;
} }
...@@ -172,12 +174,13 @@ page { ...@@ -172,12 +174,13 @@ page {
.empty_list { .empty_list {
margin-top: 20rpx; margin-top: 20rpx;
img { img {
width: 566rpx; width: 566rpx;
height: 566rpx; height: 566rpx;
margin: 40rpx auto 60rpx; margin: 40rpx auto 60rpx;
display: block; display: block;
border: 1px dashed rgb(182, 182, 182); // border: 1px dashed rgb(182, 182, 182);
} }
.addBtn { .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