完善页面

This commit is contained in:
wangxiaowei
2025-10-28 00:28:42 +08:00
parent b25f746919
commit b9ab2c63b9
18 changed files with 358 additions and 123 deletions

View File

@ -1,28 +1,42 @@
<template>
<view class="address-form" :data-theme='theme()' :class="theme() || ''">
<navbar title="新增地址"></navbar>
<form @submit="formSubmit" @reset="formReset">
<view class="bg-white p-0-30 f30">
<view class="d-s-c border-b-d9">
<text class="key-name">收货人</text>
<input class="ml20 flex-1 f32 p-30-0" name="name" type="text" placeholder-class="grary9" v-model="address.name"
placeholder="请输入收货人姓名" />
</view>
<view class="d-s-c border-b-d9">
<text class="key-name">联系方式</text>
<input class="ml20 flex-1 f32 p-30-0" name="phone" type="text" placeholder-class="grary9" v-model="address.phone"
placeholder="请输入收货人手机号" />
</view>
<view class="d-s-c border-b-d9">
<text class="key-name">所在地区</text>
<view class="input-box flex-1">
<input class="ml20 f32 flex-1 p-30-0" type="text" value="" placeholder-class="grary9" placeholder="" v-model="selectCity"
disabled="true" @click="showMulLinkageThreePicker" />
<view class="bg-whitef30" style="margin-top: 44rpx;">
<view class="p-0-30 ">
<view class="d-s-c border-b">
<text class="key-name">联系人</text>
<input class="ml20 flex-1 f32 p-30-0" name="name" type="text" placeholder-class="grary9" v-model="address.name"
placeholder="请填写联系人" style="font-size: 30rpx;"/>
</view>
<view class="d-s-c border-b">
<text class="key-name">电话</text>
<input class="ml20 flex-1 f32 p-30-0" name="phone" type="text" placeholder-class="grary9" v-model="address.phone"
placeholder="请填写联系电话" style="font-size: 30rpx;"/>
</view>
<view class="d-s-c border-b">
<text class="key-name">省市区</text>
<view class="input-box flex-1">
<input class="ml20 f32 flex-1 p-30-0" type="text" value="" placeholder-class="grary9" placeholder="" v-model="selectCity"
disabled="true" @click="showMulLinkageThreePicker" style="font-size: 30rpx;" />
</view>
</view>
<view class="d-s-c">
<text class="key-name">地址</text>
<textarea class="ml20 flex-1 p-30-0 lh150" name="detail" :auto-height="true" v-model="address.detail"
placeholder-class="grary9" placeholder="请填写具体地址" style="font-size: 30rpx;"></textarea>
</view>
</view>
<view class="d-s-c border-b-d9">
<text class="key-name">详细地址</text>
<textarea class="ml20 flex-1 p-30-0 lh150" name="detail" :auto-height="true" v-model="address.detail"
placeholder-class="grary9" placeholder="请输入街道小区楼牌号等"></textarea>
<view class="line"></view>
<view class="d-b-c" style="padding: 0 30rpx; margin-top: 32rpx;">
<view class="key-name" style="width: 200rpx;">设为默认地址</view>
<view class="">
<radio style="transform:scale(0.6)" color='#4C9F44' :value="item.address_id+''" :checked="default_id==item.address_id+''"
@click="radioChange(item.address_id)" />
</view>
</view>
</view>
<view class="p30"><button form-type="submit" class="theme-btn f32 mt60 addBtn">保存</button></view>
@ -32,10 +46,12 @@
</template>
<script>
import navbar from '@/components/navbar.vue';
import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
export default {
components: {
mpvueCityPicker
mpvueCityPicker,
navbar
},
data() {
return {
@ -178,8 +194,22 @@
}
.addBtn {
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
position: fixed;
bottom: 40rpx;
left: 0;
right: 0;
height: 90rpx;
line-height: 90rpx;
border-radius: 8rpx;
margin: 0 60rpx;
}
.border-b {
border-bottom: 1rpx soli#F2F2F2 !important;
}
.line {
height: 12rpx;
background: #F7F7F7;
}
</style>

View File

@ -1,20 +1,27 @@
<template>
<view v-if="!loadding" :data-theme='theme()' :class="theme() || ''">
<view v-if="listData.length>0" class="pbenv">
<view class="address-list bg-white">
<view class="address p-30-0 border-b-d" v-for="(item,index) in listData" :key="index">
<view class="info flex-1 mb10">
<view class="user f32 d-b-c">
<text>{{item.name}}</text>
<text class="ml20 gray9 f26">{{item.phone}}</text>
</view>
<view class="pt20 f26 gray3">
{{item.region.province}}{{item.region.city}}{{item.region.region}}{{item.detail}}
<view class="address-list">
<view class="address bg-white d-b-c" v-for="(item,index) in listData" :key="index">
<view class="">
<view class=" flex-1 mb10">
<view class="user f32 address-info">
<text>{{item.name}}</text>
<text class="ml20">{{item.phone}}</text>
</view>
<view class="pt20 f26 gray3">
{{item.region.province}}{{item.region.city}}{{item.region.region}}{{item.detail}}
</view>
</view>
</view>
<view class="d-b-c">
<view class="" @click="editAddress(item.address_id)">
<image class="add_icon_img" src="@/static/icon/edit_address.png" mode="" style="width: 48rpx; height: 48rpx;"></image>
</view>
<!-- <view class="d-b-c">
<view class="radio d-s-c">
<radio style="transform:scale(0.6)" :color='getThemeColor()' :value="item.address_id+''" :checked="default_id==item.address_id+''"
<radio style="transform:scale(0.6)" color='#4C9F44' :value="item.address_id+''" :checked="default_id==item.address_id+''"
@click="radioChange(item.address_id)" />
<text class="">默认地址</text>
</view>
@ -29,16 +36,16 @@
<text class="gray9 ml10">编辑</text>
</view>
</view>
</view>
</view> -->
</view>
</view>
<view class="add_add-btn theme-btn" @click="addAddress()">新增收货地址</view>
</view>
<view v-else>
<view class="none_add">
<image class="no_add" src="/static/no_adress.png" mode="aspectFill"></image>
<image class="no_add" src="/static/no_adress.png" mode=""></image>
</view>
<view class="no_add_add" @click="addAddress()">新增收货地址</view>
<view class="no_add_add" @click="addAddress()">新增地址</view>
</view>
</view>
</template>
@ -63,6 +70,7 @@
onLoad: function(options) {
this.options = options;
},
onShow: function() {
uni.showLoading({
title: '加载中'
@ -146,12 +154,13 @@
<style lang="scss">
page {
background-color: #FFFFFF;
background-color: $xh-bg;
}
.address-list {
margin-top: 20rpx;
border-top: 16rpx solid #F2F2F2;
padding: 0 20rpx;
padding: 0 30rpx;
padding-bottom: 90rpx;
}
@ -167,27 +176,33 @@
}
.none_add {
padding: 314rpx 214rpx 60rpx 214rpx;
display: flex;
justify-content: center;
align-items: center;
margin-top: 318rpx;
}
.no_add {
width: 322rpx;
height: 180rpx;
width: 292rpx;
height: 202rpx;
}
.no_add_add {
width: 320rpx;
height: 80rpx;
border: 2rpx solid #FFB7B7;
border-radius: 40rpx;
width: 630rpx;
margin: 0 60rpx;
height: 90rpx;
border-radius: 8rpx;
text-align: center;
line-height: 80rpx;
line-height: 90rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
@include font_color('font_color');
@include border_color('border_color');
margin: 0 auto;
background: #365A9A;
color: #FFFFFF;
position: fixed;
bottom: 40rpx;
left: 0;
right: 0;
}
.add_add {
@ -223,13 +238,13 @@
}
.add_add-btn{
position: fixed;
bottom: calc(env(safe-area-inset-bottom) + 20rpx);
bottom: 40rpx;
width:690rpx;
margin: 20rpx 30rpx;
box-sizing: border-box;
font-size: 28rpx;
height: 80rpx;
border-radius: 40rpx;
height: 90rpx;
border-radius: 8rpx;
display: flex;
justify-content: center;
align-items: center;
@ -238,4 +253,20 @@
padding-bottom: calc(env(safe-area-inset-bottom) + 120rpx);
box-sizing: border-box;
}
.address-info {
font-size: 30rpx;
color: #121212;
line-height: 42rpx;
}
.address {
margin-bottom: 20rpx;
border-radius: 16rpx;
padding: 30rpx;
.info {
padding: 30rpx;
}
}
</style>

View File

@ -1,41 +1,60 @@
<template>
<view class="address-form" :data-theme='theme()' :class="theme() || ''">
<navbar title="编辑地址"></navbar>
<form @submit="formSubmit" @reset="formReset">
<view class="bg-white p-0-30 f30">
<view class="d-s-c border-b-d9">
<text class="key-name">收货人</text>
<input class="ml20 f32 flex-1 p-30-0" name="name" type="text" v-model="address.name" placeholder-class="grary9"
placeholder="请输入收货人姓名" />
</view>
<view class="d-s-c border-b-d9">
<text class="key-name">联系方式</text>
<input class="ml20 f32 flex-1 p-30-0" name="phone" type="text" v-model="address.phone" placeholder-class="grary9"
placeholder="请输入收货人手机号" />
</view>
<view class="d-s-c border-b-d9">
<text class="key-name">所在地区</text>
<view class="input-box flex-1">
<input class="ml20 f32 flex-1 p-30-0" type="text" value="" placeholder-class="grary9" placeholder="" v-model="selectCity"
disabled="true" @click="showMulLinkageThreePicker" />
<view class="bg-white f30">
<view class="p-0-30 ">
<view class="d-s-c border-b">
<text class="key-name">联系人</text>
<input class="ml20 f32 flex-1 p-30-0" name="name" type="text" v-model="address.name" placeholder-class="grary9"
placeholder="请填写联系人" style="font-size: 30rpx;"/>
</view>
<view class="d-s-c border-b">
<text class="key-name">电话</text>
<input class="ml20 f32 flex-1 p-30-0" name="phone" type="text" v-model="address.phone" placeholder-class="grary9"
placeholder="请填写联系电话" style="font-size: 30rpx;"/>
</view>
<view class="d-s-c border-b">
<text class="key-name">省市区</text>
<view class="input-box flex-1">
<input class="ml20 f32 flex-1 p-30-0" type="text" value="" placeholder-class="grary9" placeholder="" v-model="selectCity"
disabled="true" @click="showMulLinkageThreePicker" style="font-size: 30rpx;"/>
</view>
</view>
<view class="d-s-c border-b">
<text class="key-name">地址</text>
<textarea class="ml20 flex-1 f32 p-30-0 lh150" name="detail" placeholder-class="grary9" :auto-height="true"
v-model="address.detail" placeholder="请填写具体地址" style="font-size: 30rpx;"></textarea>
</view>
</view>
<view class="d-s-c border-b-d9">
<text class="key-name">详细地址</text>
<textarea class="ml20 flex-1 f32 p-30-0 lh150" name="detail" placeholder-class="grary9" :auto-height="true"
v-model="address.detail" placeholder="请输入街道小区楼牌号等"></textarea>
<view class="line"></view>
<view class="d-b-c" style="padding: 0 30rpx; margin-top: 32rpx;">
<view class="key-name" style="width: 200rpx;">设为默认地址</view>
<view class="">
<radio style="transform:scale(0.6)" color='#4C9F44' :value="item.address_id+''" :checked="default_id==item.address_id+''"
@click="radioChange(item.address_id)" />
</view>
</view>
</view>
<view class="p30"><button form-type="submit" class="theme-btn f32 mt60 addBtn">保存</button></view>
<view class="d-f a-i-c btn">
<button class="f32 mt60 delBtn" @click="delAddress(address.address_id)">删除地址</button>
<button form-type="submit" class="theme-btn f32 mt60 addBtn">保存</button>
</view>
</form>
<mpvue-city-picker v-if="is_load" ref="mpvueCityPicker" :province="province" :city="city" :area="area" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"></mpvue-city-picker>
</view>
</template>
<script>
import navbar from '@/components/navbar.vue';
import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
export default {
components: {
mpvueCityPicker
mpvueCityPicker,
navbar
},
data() {
return {
@ -143,6 +162,7 @@
self._post('user.address/edit', formdata, function(res) {
self.showSuccess(res.msg, function() {
// #ifdef H5
uni.navigateBack({
delta: 2
@ -174,6 +194,32 @@
this.province_id = e.cityCode[0];
this.city_id = e.cityCode[1];
this.region_id = e.cityCode[2];
},
/*删除地址*/
delAddress(e) {
let self = this;
wx.showModal({
title: "提示",
content: "您确定要移除当前收货地址吗?",
success: function(o) {
o.confirm && self._get('user.address/delete', {
address_id: e
}, function(result) {
if (result.code == 1) {
uni.showToast({
title: '删除成功',
duration: 2000
});
setTimeout(res => {
uni.navigateBack()
}, 500)
}
});
}
});
}
}
};
@ -200,9 +246,38 @@
box-shadow: 0 8rpx 16rpx 0 rgba(226, 35, 26, .6);
}
.btn {
position: fixed;
bottom: 40rpx;
left: 0;
right: 0;
margin: 0 60rpx;
}
.delBtn {
width: 330rpx;
height: 90rpx;
line-height: 90rpx;
border-radius: 8rpx;
background-color: #F6F7F8;
border-color: #F6F7F8;
color: #303133 !important;
margin-right: 30rpx;
}
.addBtn {
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
width: 330rpx;
height: 90rpx;
line-height: 90rpx;
border-radius: 8rpx;
}
.border-b {
border-bottom: 1rpx soli#F2F2F2 !important;
}
.line {
height: 12rpx;
background: #F7F7F7;
}
</style>