Procházet zdrojové kódy

编辑地址和物流

junyuanz před 5 roky
rodič
revize
cd3fdabc82

+ 10 - 0
packageUser/pages/user/address/address.js

@@ -85,5 +85,15 @@ Page({
     return _request.share({
       sc: 'xcx_user_address'
     })
+  },
+  editAddress(e){
+  	var listid = e.currentTarget.dataset.listid;
+  	console.log('listid',listid);
+  	var address = this.data.addressList[listid];
+  	console.log('address',address);
+		wx.setStorageSync('editAddr', address);
+		wx.navigateTo({
+      url: '/packageUser/pages/user/newAddress/newAddress?type=1'
+    })
   }
 })

+ 5 - 0
packageUser/pages/user/address/address.wxml

@@ -21,11 +21,16 @@
         <view class="address-default__text">选用并设为默认地址</view>
         <view class="clean"></view>
       </view>
+      
       <view class="address-del">
         <image class="address-del__icon" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/addressdel.png"></image>
         <view class="address-del__text" data-val="{{item.id}}" bindtap="delAddress">删除</view>
         <view class="clean"></view>
       </view>
+      <view class="address-edit" bindtap="editAddress" data-listid="{{index}}">
+      	编辑
+      </view>
+      
       <view class="clean"></view>
     </view>
   </view>

+ 7 - 0
packageUser/pages/user/address/address.wxss

@@ -89,4 +89,11 @@
   line-height: 90rpx;
   text-align: center;
   font-size: 28rpx;
+}
+
+.address-edit{
+display: inline-block;
+float: right;
+margin-right: 15px;
+color: #eab86a;
 }

+ 1 - 1
packageUser/pages/user/applyLeader/applyLeader.wxml

@@ -1,5 +1,5 @@
 <view class="bg" wx:if="{{showpage == 0}}">
-  <view class="newAddress-top"></view>
+  <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/apply.jpg" class="item-index" mode="widthFix" style="width:100%"/>
   <view class="newAddress-line">
     <view class="newAddress-title">金 额</view>
     <input maxlength="11" class="nameText" style="color:#eab86a" disabled="disabled" value="16800" wx:if="{{userinfo.rank == 0}}"/>

+ 13 - 5
packageUser/pages/user/logistics/logistics.js

@@ -37,11 +37,19 @@ Page({
     	sign:this.data.order.sign
     }
     var success = function (res) {
-      var data = res.data.resp.result
-      data['list'] = data.list.reverse()
-      that.setData({
-        logistics: data
-      })
+    	if(res.data.resp.error_code == 0){
+    		var data = res.data.resp.result
+	      data['list'] = data.list.reverse()
+	      that.setData({
+	        logistics: data
+	      })
+    	}else{
+    		wx.showToast({
+          title: res.data.resp.reason+',请稍后再试',
+          icon: 'none',
+          duration: 2000
+        })
+    	}
     }
     _request.$post(url, params, success)
   },

+ 2 - 2
packageUser/pages/user/logistics/logistics.wxml

@@ -2,8 +2,8 @@
 	<view class="logistics-tit">
 	  <image src="../../../../images/footer/logistics.png" style="padding: 20rpx 20rpx 0;width: 80rpx;height: 70rpx;"></image>
 	  <view class="logistics-rbox">
-	    <h6 class="ellipsisLn">{{logistics.company}}快递</h6>
-		<p>快递单号:{{logistics.no}}</p>
+	    <h6 class="ellipsisLn">{{order.express_company}}快递</h6>
+		<p>快递单号:{{order.express_order_no}}</p>
 	  </view>
 	  <view class="clean"></view>
 	</view>

+ 29 - 3
packageUser/pages/user/newAddress/newAddress.js

@@ -7,9 +7,25 @@ Page({
     region: ['北京市', '北京市', '东城区'],
     name: '',
     tel: 0,
-    more: ''
+    more: '',
+    type: 0,//0为新建,1为编辑
   },
   onLoad: function (options) {
+  	console.log('options',options)
+  	if(options.type == 1){
+  		var address = wx.getStorageSync('editAddr');
+  		console.log('addrhere',address)
+  		this.setData({
+        type: 1,
+        address:address.province+address.city+address.district,
+        region:[address.province,address.city,address.district],
+        name:address.remark,
+        tel:address.tel,
+        name:address.contact,
+        more:address.address,
+        addrid:address.id
+      })
+  	}
   },
   bindName: function (e) {
     this.setData({
@@ -58,7 +74,12 @@ Page({
   },
   requestAddress () {
     var that = this
-    var url = 'v1/address'
+    
+    if(that.data.type == 1){
+    	var url = 'v1/address/'+that.data.addrid;
+    }else{
+    	var url = 'v1/address';
+    }
     var params = {
       contact: this.data.name,
       tel: this.data.tel,
@@ -73,7 +94,12 @@ Page({
         delta: 1
       })
     }
-    _request.$post(url, params, success)
+    if(that.data.type == 1){
+    	_request.$put(url, params, success)
+    }else{
+    	_request.$post(url, params, success)
+    }
+    
   },
   bindRegionChange: function (e) {
     console.log(e)

+ 3 - 3
packageUser/pages/user/newAddress/newAddress.wxml

@@ -2,12 +2,12 @@
   <view class="newAddress-top"></view>
   <view class="newAddress-line">
     <view class="newAddress-title">收货人</view>
-    <input maxlength="11" class="nameText" placeholder="请填写收件人姓名" placeholder-class="text-placeholder" bindinput="bindName" />
+    <input maxlength="11" class="nameText" placeholder="请填写收件人姓名" placeholder-class="text-placeholder" bindinput="bindName" value="{{name}}"/>
     <view class="clean"></view>
   </view>
   <view class="newAddress-line">
     <view class="newAddress-title">联系电话</view>
-    <input type="number" maxlength="12" class="nameText" placeholder="请填写收件人联系电话" placeholder-class="text-placeholder" bindinput="bindTel" />
+    <input type="number" maxlength="12" class="nameText" placeholder="请填写收件人联系电话" placeholder-class="text-placeholder" bindinput="bindTel" value="{{tel}}"/>
     <view class="clean"></view>
   </view>
   <picker mode="region" bindchange="bindRegionChange" value="{{region}}" >
@@ -22,7 +22,7 @@
   </picker>
   <view class="newAddress-more">
     <view class="newAddress-more__title">详细地址</view>
-    <textarea maxlength="120" class="textarea"  auto-height placeholder="请填写详细的收件地址"  placeholder-class="text-placeholder" bindinput="bindMore" />
+    <textarea maxlength="120" class="textarea"  auto-height placeholder="请填写详细的收件地址"  placeholder-class="text-placeholder" bindinput="bindMore" value="{{more}}"/>
   </view>
   <view class="newAddress-tip">
     <view class="tip-title">温馨提示</view>

+ 1 - 1
project.config.json

@@ -19,7 +19,7 @@
 			"disablePlugins": [],
 			"outputPath": ""
 		},
-		"useCompilerModule": true,
+		"useCompilerModule": false,
 		"userConfirmedUseCompilerModuleSwitch": false,
 		"compileHotReLoad": false,
 		"useIsolateContext": true