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]);
}