微信小程序-收货地址开发

简介: 微信小程序-收货地址开发

主页:写程序的小王叔叔的博客欢迎来访👀

支持:点赞收藏关注


1、效果

image.png


2、获取省市县联动

2.1)所有城市json数组文件参照,文件我已上传我的资源

2.2)开始写组件代码

添加收货地址页面的js文件

3、wxml

添加收货地址的wxml文件

<view class="body" wx:if="{{loaded}}"><view class="ipt"><input bindinput="changeName" placeholder="收货人姓名" value="{{consigee}}"/></view><view class="ipt"><input bindinput="changePhone" placeholder="收货人手机号码" value="{{phone}}"/></view><view class="section"><view class="picker" bindtap="translate" style="padding-left:10px;color:#666;" placeholder="请选择">            地区: {{province}}{{city}}{{county}}</view></view><view class="ipt"><input bindinput="changeAddress" placeholder="详细收货地址" value="{{address}}"/></view><view class="btn" bindtap="submit"> 确认提交 </view><!--地区选择器--><view class="animation-element-wrapper" animation="{{animation}}" style="visibility:{{show ? 'visible':'hidden'}}" bindtap="hiddenFloatView" data-id="444"><view class="animation-element" catchtap="nono"><text class="left-bt" catchtap="hiddenFloatView" data-id="555">取消</text><text class="right-bt" catchtap="hiddenFloatView" data-id="666">确定</text><view class="line"></view><picker-view indicator-style ="height: 50rpx;" value="{{value}}" bindchange="bindChange" catchtap="nono"><!----><picker-view-column><view wx:for="{{provinces}}"  wx:key="">{{item.name}}</view></picker-view-column><!--地级市--><picker-view-column><view wx:for="{{citys}}" wx:key="">{{item.name}}</view></picker-view-column><!--区县--><picker-view-column><view wx:for="{{countys}}" wx:key="">{{item.name}}</view></picker-view-column></picker-view></view></view></view>


4、js

添加收货地址 嵌入保存  + 编辑的回显方法

onLoad: function (options) {
varthat=this;
//获取省市区县数据    areaInfo=area.getAreaInfo();
getProvinceData(that);
if (wx.getStorageSync('toEdit') ==true){     
wx.request({
      })     
    }
  },
//提交按钮事件submit: function () {
var_this=this;
if (_this.valid()) {     
varaddr= {              
name: _this.data.consigee,
phone: _this.data.phone,
address: _this.data.address ,
      };
wx.request({      
      }) 
    }
  },

5、wxss

收货列表页的css效果

.body {
margin: 10px0;
background-color: #fff;
box-shadow: 5px0#f7f7f7;
font-size: 13px;
font-family: 'microsoft yahei',Verdana,Arial,Helvetica,sans-serif;
}
.shdz {
display: block;
height: 2.777em;
line-height: 2.777em;
margin: 10pxauto;
width: 80%;
text-align: center;
background: #ff6000;
color: #fff;
border-radius: 8px;
border: none;
font-size: 1.333em;
}
.m_box {
width: 80%;
margin: 12pxauto;
background: #eee;
border-radius: 10px;
box-shadow: 03px#f7f7f7;
}
.m_box.m_address_list {
padding: 1.1111em;
line-height: 2em;
}
.m_address_list.m_control {
display: flex;padding:  10px0 ;
}
.m_address_list.m_control.m_box_control  {
padding: 5px10px ; 
margin:5px5px;
background:#fff;
border-radius: 10px;
}
.m_address_list.m_control.m_box_control_select  {
padding: 5px10px ; 
margin:5px5px;
background:#fff3e8;
color:#ff6000;
border-radius: 10px;
}

添加收获地址的css

.body {
margin: 20px0;
background-color: #fff;
box-shadow: 5px0#f7f7f7;
font-size: 15px;
font-family: 'microsoft yahei',Verdana,Arial,Helvetica,sans-serif;
}
.ipt{background: #eee; margin: 10px;width:95%;}
.iptinput{height:40px;padding-left:10px; }
.section{line-height:40px;background: #eee; margin: 10px;height:40px;width:95%;}
.btn {
display: block;
height: 2.277em;
line-height: 2.277em;
margin: 10%auto;
width: 80%;
text-align: center;
background: #ff6000;
color: #fff;
border-radius: 8px;
border: none;
font-size: 1.133em;
}
.infoText{
margin-top: 20rpx;
text-align: center;
width: 100%;
justify-content: center; 
}
picker-view{
background-color: white;
padding: 0;
width: 100%; 
height: 380rpx;
bottom: 0;
position: fixed;
}
picker-view-columnview{
vertical-align:middle; 
font-size: 28rpx;
line-height: 28rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
/* ----------------------------------------- */.animation-element-wrapper {
display: flex;  
position: fixed;
left: 0;
top:0;
height: 100%;
width: 100%;
background-color: rgba(0, 0, 0, 0.6);
}
.animation-element {
display: flex;
position: fixed;
width: 100%;
height: 470rpx;
bottom: 0;
background-color: rgba(255, 255, 255, 1);
}
.animation-button {
top:20rpx;
width: 290rpx;
height: 100rpx;  
align-items:center;
}
text{
color: #999999;
display: inline-flex;  
position: fixed;
margin-top: 20rpx;
height: 50rpx;
text-align: center;
line-height: 50rpx;
font-size: 34rpx;
font-family: Arial, Helvetica, sans-serif;
}
.left-bt{
left: 30rpx;
}
.right-bt {
right: 30rpx;
}
.line{
display: block;
position: fixed;
height: 1rpx;
width: 100%;
margin-top: 89rpx; 
background-color: #eeeeee;
}



转载声明:本文为博主原创文章,未经博主允许不得转载

⚠️注意 ~

💯本期内容就结束了,如果内容有误,麻烦大家评论区指出!

如有疑问❓可以在评论区💬或私信💬,尽我最大能力🏃‍♀️帮大家解决👨‍🏫!

如果我的文章有帮助到您,欢迎点赞+关注✔️鼓励博主🏃,您的鼓励是我分享的动力🏃🏃🏃~

相关文章
|
4月前
|
人工智能 小程序 前端开发
一个小程序轻量AR体感游戏,开发实现解决方案
针对青少年运动兴趣不足问题,AR体感游戏凭借沉浸式互动体验脱颖而出。结合小程序“AI运动识别”插件与WebGL渲染技术,可实现无需外设的轻量化AR健身游戏,如跳糕、切水果等,兼具趣味性与锻炼效果,适用于儿童健身及职工团建,即开即玩,低门槛高参与。
|
4月前
|
移动开发 小程序 前端开发
小程序开发平台有哪些?哪个好
小程序的开发方式丰富多元,开发团队可根据自身的技术背景、项目具体需求以及资源状况,灵活挑选最为适宜的开发路径。以下将详细介绍几种主流的小程序开发方式。
486 2
|
4月前
|
运维 小程序 数据可视化
小程序开发平台有哪些?SaaS小程序制作平台哪个好
小程序开发模式详解:自主开发、SaaS小程序制作平台与外包全对比 选择合适的小程序开发模式,是项目成功的基石。这三种模式在成本、周期、控制力和灵活性上各有千秋,适用于不同阶段和不同类型的企业。下面我们将逐一深入剖析。
370 7
|
4月前
|
移动开发 小程序 前端开发
小程序快速开发平台有哪些?
小程序开发并非“一刀切”,需结合技术储备、资金预算、时间规划及功能需求等多维度因素综合考量。以下为您详细拆解五种主流开发方案及其适用场景,助您精准匹配开发路径。
297 3
|
4月前
|
移动开发 小程序 前端开发
小程序开发平台有哪些?小程序开发制作软件推荐
小程序开发方案全解析:5种主流方式与选择指南 小程序开发需根据技术能力、预算、时间及功能需求综合决策。以下为5种主流开发方案及适用场景分析:
25850 0
|
5月前
|
消息中间件 人工智能 Java
抖音微信爆款小游戏大全:免费休闲/竞技/益智/PHP+Java全筏开源开发
本文基于2025年最新行业数据,深入解析抖音/微信爆款小游戏的开发逻辑,重点讲解PHP+Java双引擎架构实战,涵盖技术选型、架构设计、性能优化与开源生态,提供完整开源工具链,助力开发者从理论到落地打造高留存、高并发的小游戏产品。
|
6月前
|
小程序 JavaScript API
uni-halo + 微信小程序开发实录:我的第一个作品诞生记
这篇文章介绍了使用uni-halo框架进行微信小程序开发的过程,包括选择该框架的原因、开发目标以及项目配置和部署的步骤。
281 0
uni-halo + 微信小程序开发实录:我的第一个作品诞生记
|
9月前
|
小程序 前端开发 Android开发
小程序微信分享功能如何开发?开放平台已绑定仍不能使用的问题?-优雅草卓伊凡
小程序微信分享功能如何开发?开放平台已绑定仍不能使用的问题?-优雅草卓伊凡
1853 29
小程序微信分享功能如何开发?开放平台已绑定仍不能使用的问题?-优雅草卓伊凡