微信小程序 导入地址

index.wxml


<view class="add-address" bindtap="addAddress">

<image class="add-img"  src=""></image>新增地址

</view>

<view class="add-address" bindtap="add">

<image class="add-img"  src=""></image>导入微信地址

</view>

index.wxss

page{  

  display: flex;  

  flex-direction: column;  

  height: 100%;  

}  

.product-name-wrap{
  margin: 0px 10px;

  font-size: 14px;

  color: #404040;

}

.ui-list-item-info{
  margin: 5px 0px;

}

.ui-list-item-address{
  color: #585c64;

}

.ui-list-item-time{
  margin: 5px 0px;

}

.ui-list-item-del{
  position: absolute;

  right: 10px;

  color: #585c64;

}

/* 分割线 */

.separate {
  margin: 5px 0px;

  height: 2rpx;

  background-color: #f2f2f2;

}

.add-address{
  margin: 0 auto;

  margin-top: 30px;

  width: 150px;

  height: 35px;

  border: 1px #000 solid;

  line-height: 35px;

  text-align: center;

  color: #000;

  border-radius: 5rpx;

      display: block;

}

.add-img{
  margin-right: 15rpx;

  width: 15px;

  height: 15px;

}

index.js

add:function(){
  wx.chooseAddress({
    success (res) {
      console.log(res);
      var userName=res.userName
      let city=res.cityName
      let countyName=res.countyName
      let detailInfo=res.detailInfo
      wx.request({
        url: 'http://www.week.com/api/login/stroe',
        method:"POST",
        data:{
          userName,
          city,
          countyName,
          detailInfo,
        },
        success:ret=>{
        console.log(ret);
        }
      })
    }
  })
 },
addAddress:function(){
    wx.navigateTo({ url: '/pages/address/address' });

  },

后台

  public function stroe()
    {
        $data=input();
        $res=Sites::create($data);
        return json(['code'=>200,'msg'=>'添加成功','data'=>$res]);

    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值