ソースを参照

地址展示修改

暖心小太阳 2 ヶ月 前
コミット
cb86c80175

+ 18 - 18
pages/ucenter/addressAdd/addressAdd.js

@@ -337,25 +337,25 @@ Page({
     } else {
       //这里分2种情况 1,有城市 标识选中原有地址进来 保持不变
       //2,新增地址 初始化进入此页面时 需要调用getlocation2
-      if (that.data.addressId) return;//从已有地址进入
+      // if (that.data.addressId) return;//从已有地址进入
 
-      map.getLocation2().then(() => {
-        that.getAreaCode(app.globalData.lat, app.globalData.lng).then(res => { 
-          res.isDefault=that.data.address.isDefault;
-          // console.log('globalData',app.globalData.lat,app.globalData.lng)
-          // console.log('areaCode',res)
-          that.setData({
-            address: res,
-            selectAddress: res
-          });
-        }).catch(err => {
-          wx.showToast({
-            title: '获取地区码失败',
-            icon: 'none',
-            duration: 3000
-          });
-        });
-      }) 
+      // map.getLocation2().then(() => {
+      //   that.getAreaCode(app.globalData.lat, app.globalData.lng).then(res => { 
+      //     res.isDefault=that.data.address.isDefault;
+      //     // console.log('globalData',app.globalData.lat,app.globalData.lng)
+      //     // console.log('areaCode',res)
+      //     that.setData({
+      //       address: res,
+      //       selectAddress: res
+      //     });
+      //   }).catch(err => {
+      //     wx.showToast({
+      //       title: '获取地区码失败',
+      //       icon: 'none',
+      //       duration: 3000
+      //     });
+      //   });
+      // }) 
     }
   },
   getAreaCodeOld() {

+ 18 - 23
pages/ucenter/addressAdd/addressAdd.wxml

@@ -9,27 +9,24 @@
     <view class="form-item">
       <view class="label">电 话</view>
       <view class="content">
-        <input class="input" bindinput="bindinputMobile" value="{{address.tel}}" type="number" placeholder="手机号码"
-          maxlength="11" />
+        <input class="input" bindinput="bindinputMobile" value="{{address.tel}}" type="number" placeholder="手机号码" maxlength="11" />
       </view>
     </view>
     <!-- bindtap="chooseRegion"  -->
     <view class="form-item" bindtap="goMap">
       <view class="label">省市区</view>
       <view class="content">
-        <image src="/static/images/address.png" style="width: 28rpx;height: 35rpx;margin-right: 10rpx;"></image>
-        <input class="input" value="{{address.province + address.city + address.county}}" disabled="true"
-          placeholder="省份、城市、区县" />
+        <!-- <image src="/static/images/address.png" style="width: 28rpx;height: 35rpx;margin-right: 10rpx;"></image> -->
+        <view style="flex: 1;">
+          <view wx:if="{{address.addressName}}" style="height: 36rpx;line-height: 36rpx;font-weight: bold;">{{address.addressName}}</view>
+          <input class="input input1" value="{{address.province + address.city + address.county+address.address }}" disabled="true" placeholder="请选择服务地址"  />
+        </view>
 
-        <image src="/static/images/arrow.png" style="width: 12rpx;height: 20rpx;margin-right: 10rpx;"></image>
-      </view>
-    </view>
-    <view class="form-item">
-      <view class="label">地址</view>
-      <view class="content">
-        <input class="input" value="{{address.address}}" placeholder="请选择地址" disabled />
+
+        <image src="/static/images/arrow.png" style="width: 12rpx;height: 20rpx;margin-right: 10rpx;margin-top: 10rpx;"></image>
       </view>
     </view>
+
     <view class="form-item">
       <view class="label">门牌号</view>
       <view class="content">
@@ -43,15 +40,14 @@
     <view style="display: flex;flex-direction: column;">
       <text class="title">设为默认地址</text>
       <text class="des">提醒:每次下单会默认推荐使用该地址</text>
-    </view> 
-    <switch style="margin-right: 10rpx;" checked="{{address.isDefault == 1}}" bindchange="bindIsDefault"/>
+    </view>
+    <switch style="margin-right: 10rpx;" checked="{{address.isDefault == 1}}" bindchange="bindIsDefault" />
   </view>
 
-  
+
   <view class="form-item" wx:if="{{address.id>0}}">
-      <button style="background: #19B3FF;color: white;" data-address-id="{{address.id}}"
-        bindtap="deleteAddress">删除地址</button>
-    </view>
+    <button style="background: #19B3FF;color: white;" data-address-id="{{address.id}}" bindtap="deleteAddress">删除地址</button>
+  </view>
 
   <view class="btns">
     <button class="cannel" bindtap="cancelAddress">取消</button>
@@ -61,16 +57,15 @@
   <view class="region-select" wx:if="{{openSelectRegion}}">
     <view class="hd">
       <view class="region-selected">
-        <view class="item {{item.code == 0 ? 'disabled' : ''}} {{(regionType -1) === index ? 'selected' : ''}}"
-          bindtap="selectRegionType" data-region-type-index="{{index}}" wx:for="{{selectRegionList}}" wx:key="code">
-          {{item.name}}</view>
+        <view class="item {{item.code == 0 ? 'disabled' : ''}} {{(regionType -1) === index ? 'selected' : ''}}" bindtap="selectRegionType" data-region-type-index="{{index}}" wx:for="{{selectRegionList}}" wx:key="code">
+          {{item.name}}
+        </view>
       </view>
       <view class="done {{selectRegionDone ? '' : 'disabled'}}" bindtap="doneSelectRegion">确定</view>
     </view>
     <view class="bd">
       <scroll-view scroll-y class="region-list">
-        <view class="item {{item.selected ? 'selected' : ''}}" bindtap="selectRegion" data-region-index="{{index}}"
-          wx:for="{{regionList}}" wx:key="code">{{item.name}}</view>
+        <view class="item {{item.selected ? 'selected' : ''}}" bindtap="selectRegion" data-region-index="{{index}}" wx:for="{{regionList}}" wx:key="code">{{item.name}}</view>
       </scroll-view>
     </view>
   </view>

+ 3 - 0
pages/ucenter/addressAdd/addressAdd.wxss

@@ -25,6 +25,9 @@ page {
   line-height: 44rpx;
   overflow: hidden;margin-top: 10rpx;
 }
+.add-address .input1{
+color: #999;
+}
 .add-address .label{
   font-size: 32rpx;
   font-weight: bold;