Browse Source

新增地址导入

master
杜叶春 2 years ago
parent
commit
6c0082085a
  1. 3
      app.json
  2. 36
      pages/address/index.js
  3. 6
      pages/address/index.wxml
  4. 6
      pages/login/login.wxml
  5. 4
      pages/login/login.wxss

3
app.json

@ -96,5 +96,8 @@
} }
] ]
}, },
"requiredPrivateInfos":[
"chooseAddress"
],
"sitemapLocation": "sitemap.json" "sitemapLocation": "sitemap.json"
} }

36
pages/address/index.js

@ -305,4 +305,40 @@ Page({
url: '../address/upaddress?addr_id=' + addrId, url: '../address/upaddress?addr_id=' + addrId,
}) })
}, },
chooseAddress: function () {
var that = this;
if (wx.chooseAddress) {
wx.chooseAddress({
success: function (res) {
that.setData({
userName: res.userName,
mobile: res.telNumber,
place: res.provinceName+'-'+res.cityName+'-'+res.countyName,
address: res.detailInfo,
})
that.saveAddress()
},
})
} else {
console.log('当前微信版本不支持chooseAddress');
}
},
// 点击保存
saveAddress: function (e) {
var that = this;
WXAPI.saveAddress({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
user_name: that.data.userName,
mobile: that.data.mobile,
place: that.data.place,
is_default: 1,
address: that.data.address,
}).then(res => {
if (res.code == 200) {
}
});
},
}) })

6
pages/address/index.wxml

@ -45,6 +45,12 @@
<view style='color:#fff'>新增地址</view> <view style='color:#fff'>新增地址</view>
</view> </view>
</navigator> </navigator>
<view wx:if="{{!flag}}" style='width: 94%;margin: 0 auto;margin-bottom: 50px;' bindtap="chooseAddress">
<view hidden="{{hiddenAddress}}" class="add-address" style="background-color:#FF6347;">
<view class="iconfont icon-tianjia"></view>
<view style='color:#fff'>导入地址</view>
</view>
</view>
<view class="add_dell" wx:if="{{flag}}"> <view class="add_dell" wx:if="{{flag}}">
<view class='add_left'> <view class='add_left'>
<view bindtap="bindSelectAll" class='heji'> <view bindtap="bindSelectAll" class='heji'>

6
pages/login/login.wxml

@ -12,7 +12,11 @@
<!-- 用户名 --> <!-- 用户名 -->
<view class="userCs"> <view class="userCs">
<image src="/images/user.png" class="user"></image> <image src="/images/user.png" class="user"></image>
<input placeholder="请输入账号/手机号" type="text" value="{{account}}" bindinput="accountInput" /> <view class="inputview">
<input placeholder="请输入账号/手机号" type="text" value="{{account}}" bindinput="accountInput" />
<!-- 在这个input框下面再重新加一个input框,并做相关的设置 -->
<input type='text' class="inptHideen"></input>
</view>
</view> </view>
<!-- 密码 --> <!-- 密码 -->
<view class=passwordCs"> <view class=passwordCs">

4
pages/login/login.wxss

@ -73,6 +73,10 @@ page{
margin-left: 30rpx; margin-left: 30rpx;
line-height: 55rpx; line-height: 55rpx;
} }
.inptHideen{
height:0px !important;
min-height:1rpx !important;
}
/* 密码图标+输入框+小眼睛图标+下划线父容器view */ /* 密码图标+输入框+小眼睛图标+下划线父容器view */
.passwordCs{ .passwordCs{
margin-top: 190rpx; margin-top: 190rpx;

Loading…
Cancel
Save