微信小程序 仿京东 省市县地址选择

效果图

请添加图片描述
请添加图片描述
请添加图片描述

因为是外包项目,代码以实现功能为要求而已,轻喷。

小程序部分代码

wxml

<view class="page">
<view class="content">
    <view class="perosn item">
        <text>收货人 :</text>
        <input bindinput="inputName" value="{
  {formData.name}}"  placeholder="请填写收货人姓名"/>
    </view>
    <view class="phone  item">
        <text>手机号码:</text>
        <input  bindinput="inputPhone" value="{
  {formData.phone}}" placeholder="请填写收货人手机号"/>
    </view>
    <view class="area item"  bindtap="handleArea">
        <text>所在地区:</text>
        <input  bindinput="inputArea" value="{
  {formData.area}}"  disabled="true"
         unselectable='on'
         placeholder="请选择省市区"  />
    </view>
    <view class="detail item">
        <text>详细地址:</text>
        <input bindinput="inputDetail" value="{
  {formData.detail}}"  placeholder="街道、楼牌号详细地址"/>
    </view>
    <view class="tag">
        <text>标签</text>
    </view>
    <view class="is-default">
        <view>
            <text>设置默认地址</text>
            <text>提醒: 每次下单会默认推荐使用地址</text>
        </view>
        <view>
            <switch checked="{
  {switchChecked}}" bindchange="switchChange"/>
        </view>
    </view>

</view>
<view class="bottom">
    <view class="add-address" bindtap="saveAndUse">保存并使用</view>
</view>
<view class="province-city-area" wx:if="{
  {isShowActoion}}">
  <view class="content-field {
  {isShowActoion?'show-animation':''}}" >
      <view class="content" >
        <view class="header" >
          <text class="title">请选择所在地区</text>
          <view class="close" bindtap="toClose">x</view>
        </view>
      <view class="country">中国大陆</view>
      <view class="select-province-city-area">
          <view  class="options" wx:for="{
  {options}}" wx:key="index">
              <view bindtap="optionChange"  data-index="{
  {index}}"  class="{
  { item.isSelect?'selected': '' }}">{
  {item.name}}</view>
          </view>
      </view>
      <view class="province-field-select" wx:if="{
  {navIndex==1}}">
          <view class="hot-city">
            <view class="title">热门城市</view>
            <view class="hot-city-area">
                <view class="city" 
                    wx:for="{
  {hotCity}}" 
                    wx:key="index"
                    data-index="{
  {index}}"
                    bindtap="hotCitySelect"
                    >{
  {item.shortName}}</view>
            </view>
         </view>
        <view class="options-content">
            <view wx:for="{
  {provinceAlphaList}}" wx:key="index">
                <view class="alpha-content">{
  {item}}</view>
                <view>
                    <view class="area-content"  
                    wx:for="{
  {provinceDataMap[item]}}"
                    wx:for-item="subItem"
                    wx:for-index="subIndex"
                    wx:key="index"
                    data-alpha=&
  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值