Kaynağa Gözat

地址选择修改,登录修改

WinG 2 yıl önce
ebeveyn
işleme
e4a164d473

+ 74 - 1
packageUser/pages/user/newAddress/newAddress.js

@@ -1,6 +1,7 @@
 var _request = require('../../../../utils/request.js')
 var validator = require('../../../../utils/validator.js')
 var _handle = require('../../../../utils/handle.js')
+var placeJson = require('../../../../utils/place.js')
 Page({
   data: {
     address: '请选择',
@@ -9,6 +10,11 @@ Page({
     tel: 0,
     more: '',
     type: 0,//0为新建,1为编辑
+    multiArray: [['北京市'], ['北京市'], ['东城区']],
+    multiIndex: [0, 0, 0],
+    placearr:[],
+    cityarr:[],
+    areaarr:[]
   },
   onLoad: function (options) {
   	console.log('options',options)
@@ -26,6 +32,8 @@ Page({
         addrid:address.id
       })
   	}
+
+    this.getPlaceData();
   },
   bindName: function (e) {
     this.setData({
@@ -113,5 +121,70 @@ Page({
     return _request.share({
       sc: 'xcx_user_newaddress'
     })
-  }
+  },
+  getPlaceData(){
+    var placedata = placeJson['placeJson'];
+    console.log('t',this.data.multiIndex);
+    var placei = this.data.multiIndex[0];
+    var cityi = this.data.multiIndex[1];
+    var areai = this.data.multiIndex[2];
+
+    console.log('placei',placei);
+    console.log('cityi',cityi);
+    console.log('areai',areai);
+    var arr1 = [];
+    var arr2 = [];
+    var arr3 = [];
+    console.log('placeJson',placedata);
+    for(var i in placedata){
+      var data = placedata[i];
+      arr1.push(data['name']);
+
+      if(placei == i){
+        for(var c in data['city']){
+          var citydata = data['city'][c];
+          arr2.push(citydata['name']);
+
+          if(cityi == c){
+            arr3 = citydata['area'];
+          }
+        }
+      }
+    }
+
+    console.log(arr1);
+    console.log(arr2);
+    console.log(arr3);
+
+    var mixdata = [];
+    mixdata.push(arr1);
+    mixdata.push(arr2);
+    mixdata.push(arr3);
+    this.setData({
+      multiArray:mixdata,
+      placearr:arr1,
+      cityarr:arr2,
+      areaarr:arr3
+    })
+  },
+  bindMultiPickerChange: function (e) {
+    console.log('picker发送选择改变,携带值为', e.detail)
+    this.setData({
+      multiIndex: e.detail.value,
+      region: [this.data.placearr[e.detail.value[0]],this.data.cityarr[e.detail.value[1]],this.data.areaarr[e.detail.value[2]]],
+      address: this.data.placearr[e.detail.value[0]] + this.data.cityarr[e.detail.value[1]] + this.data.areaarr[e.detail.value[2]]
+    })
+  },
+  bindMultiPickerColumnChange: function (e) {
+    console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
+    var data = {
+      multiArray: this.data.multiArray,
+      multiIndex: this.data.multiIndex
+    };
+    data.multiIndex[e.detail.column] = e.detail.value;
+    console.log(data.multiIndex);
+    this.setData(data);
+
+    this.getPlaceData();
+  },
 })

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

@@ -10,7 +10,7 @@
     <input type="number" maxlength="12" class="nameText" placeholder="请填写收件人联系电话" placeholder-class="text-placeholder" bindinput="bindTel" value="{{tel!=0?tel:''}}"/>
     <view class="clean"></view>
   </view>
-  <picker mode="region" bindchange="bindRegionChange" value="{{region}}" >
+  <!-- <picker mode="region" bindchange="bindRegionChange" value="{{region}}">
     <view class="newAddress-line">
       <view class="newAddress-title">所在地区</view>
       <view class="newAddress-picker ">
@@ -19,7 +19,21 @@
       </view>
       <view class="clean"></view>
     </view>
-  </picker>
+  </picker> -->
+
+  <view class="section">
+    <picker mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{multiArray}}">
+      <view class="newAddress-line">
+        <view class="newAddress-title">所在地区</view>
+        <view class="newAddress-picker ">
+          <image class="newAddress-picker__icon" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/right.png"></image>
+          <view class="ellipsis newAddress-picker__text">{{address}}</view>
+        </view>
+        <view class="clean"></view>
+      </view>
+    </picker>
+  </view>
+
   <view class="newAddress-more">
     <view class="newAddress-more__title">详细地址</view>
     <textarea maxlength="120" class="textarea"  auto-height placeholder="请填写详细的收件地址"  placeholder-class="text-placeholder" bindinput="bindMore" value="{{more}}"/>
@@ -31,6 +45,6 @@
   <form bindsubmit="save" report-submit="{{true}}" class="newAddress-form">
     <button formType="submit" class="newAddress-btn">
       保存
-    </button>
+    </button> 
   </form>
 </view>

+ 5 - 4
pages/home/home.js

@@ -60,7 +60,7 @@ Page ({
     userinfo:{},
 	nowseckill_data:'',
 	
-	statusBarHeight:20,
+	statusBarHeight:0,//20
 	navBarHeight:45,
 	windowWidth:375,
 	word:'',
@@ -73,9 +73,10 @@ Page ({
   onLoad: function () {
 	  const info = wx.getSystemInfoSync();
 	  console.log('info',info);
-	  this.setData({
-		statusBarHeight:info.statusBarHeight
-	  })
+	
+	 //  this.setData({
+		// statusBarHeight:info.statusBarHeight
+	 //  })
     // this.getzhunongList()
     this.setData({
       vershow: getApp().globalData.vershow,

+ 2 - 3
pages/home/home.json

@@ -1,11 +1,10 @@
 {
-  "navigationBarTitleText": "凤凰菁选商城商城",
+  "navigationBarTitleText": "珠海凤凰高科电子商务有限公司",
   "usingComponents": {
     "currency": "../../component/currency/currency",
     "format-time": "../../component/formatTime/formatTime"
   },
   "enablePullDownRefresh": true,
   "backgroundColor": "#f2f4f6",
-  "backgroundTextStyle": "dark",
-  "navigationStyle": "custom"
+  "backgroundTextStyle": "dark"
 }

+ 1 - 1
pages/home/home.wxss

@@ -1067,7 +1067,7 @@ font-size: 14px;
 	    z-index: 999;
 	    background: rgba(255,255,255,0.75);
 	    left: 15rpx;
-	    width: 70%;
+	    width: calc(100% - 40rpx);
 	    border-radius: 45rpx;
 		    border: 1rpx solid #cdcdcd;
 			margin-top: 10rpx;

+ 1 - 1
pages/pay/pay.js

@@ -331,7 +331,7 @@ Page({
 		}else{
 			console.log('5');
 			// afterdec = (that.data.total - that.data.payData.paied_silver - that.data.payData.dis_amount)+that.data.yunfei-that.data.payData.coupon_price;
-			afterdec = that.data.total + that.data.yunfei - that.data.payData.paied_silver - that.data.payData.coupon_price;
+			afterdec = that.data.total + that.data.yunfei - that.data.payData.paied_silver - that.data.payData.coupon_price - that.data.payData.paied_cash;
 		}
 
 		var source_afterdec = afterdec;

+ 1 - 1
pages/pay/pay.wxml

@@ -330,7 +330,7 @@
         	<text class="red">{{(minusTotal+yunfei) / 100}}积分</text>
         </view>
         <view wx:else style="display: inline;">
-        	<currency wx:if="{{useBalance}}" symbol="¥" value="{{afterdec - (payData.dis_amount>0?payData.dis_amount: pay_cash)}}" class="red"></currency>
+        	<currency wx:if="{{useBalance}}" symbol="¥" value="{{afterdec - (payData.dis_amount>0?payData.dis_amount: disAmount) - (payData.paied_cash>0?payData.paied_cash: pay_cash)}}" class="red"></currency>
 	        <!-- <currency wx:else symbol="¥" value="{{payData.pay_way == '' ? total+yunfei : payData.paied_price}}" class="red"></currency> -->
 	        <currency wx:else symbol="¥" value="{{payData.pay_way == '' ? minusTotal+yunfei : minusTotal+yunfei-payData.coupon_price-payData.paied_cash}}" class="red"></currency>
 	        

+ 110 - 4
pages/user/all/all.js

@@ -8,6 +8,7 @@ var url = '' // 分享或模板落地页
 var invite = 0 //邀请id
 var poster = []
 var project = []
+const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0';
 Page({
   data: {
     userInfo: {},
@@ -24,7 +25,9 @@ Page({
 	bindTelfirst:0,
 	cashbalance:0,
 	kfqr:'',//客服二维码
-	showqr:false
+	showqr:false,
+	avatarUrl: defaultAvatarUrl,
+	nickname:''
   },
   onLoad: function () {
 ////	console.log(options)
@@ -94,6 +97,7 @@ Page({
 						wx.setStorageSync('lbt_session_time', Date.now())
 						wx.setStorageSync('lbt_token_key', res.data.token)
 						console.log('nowtoken',res.data.token);
+						
 	  				  	if(res.data.wx_user && res.data.wx_user.head != ''){
 	  				  		var userInfo = res.data.wx_user;
 							
@@ -110,10 +114,18 @@ Page({
 							// }
 								//checkwxhead---start
 								// console.log('that.data.checkhead',that.data.checkhead);
+								
+								
 	  						    if(res.data.wx_user.head == '' ){
 									that.setData({
 										checkhead: false
 									})
+									
+									that.setData({
+										    userInfo: 'nologin'
+										  })
+									
+									/*
 	  						    	wx.getSetting({
 	  						      success: res => {
 	  						        var auth = res.authSetting
@@ -156,7 +168,10 @@ Page({
 	  							        }
 	  							      }
 	  							    })
+									
+									*/
 	  						    }
+								
 	  						  //checkwxhead---end
 	  				  	}else{
 	  				  		that.setData({
@@ -232,7 +247,29 @@ Page({
   getUserProfile:function(){
 	  console.log('tap')
 	  var that = this
-
+console.log('getUserProfile')
+    const app = this
+	
+	//增加判断昵称和头像是否设置
+	if(app.data.avatarUrl == defaultAvatarUrl){
+		wx.showToast({
+			title: '请设置头像',
+			icon: 'none',
+			duration: 2000
+		});
+		return;
+	}
+	
+	if(app.data.nickname == ''){
+		wx.showToast({
+			title: '请设置昵称',
+			icon: 'none',
+			duration: 2000
+		});
+		return;
+	}
+	
+	console.log('用户同意了授权');
 	     //    wx.getUserProfile({
 	     //      desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
 	     //      success: (res) => {
@@ -264,7 +301,10 @@ Page({
 			wx.getUserProfile({
 			  desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
 			  success: function(res3) {
-			    console.log('userinfo',res3)
+			    
+				res3.userInfo.avatarUrl = that.data.avatarUrl;
+				res3.userInfo.nickName = that.data.nickname;
+				console.log('userinfo',res3)
 			    var url = 'xcx/save_wx_user/info'
 				  var params = {
 					userinfo: JSON.stringify(res3.userInfo)
@@ -615,5 +655,71 @@ Page({
   },
   catchtapQR:function(){
   	  console.log('catchtapQR');
-  }
+  },
+  
+  
+  /**
+   * 用户头像设置
+   */
+  onChooseAvatar(e) {
+    const { avatarUrl } = e.detail 
+    this.setData({
+      avatarUrl,
+    })
+  },
+  
+  /**
+   * 用户昵称设置
+   */
+  changeNickName(e) {
+  	  console.log(e.detail);
+  	this.setData({
+  	  nickname: e.detail.value
+  	})
+  },
+  
+  savebtn(){
+  	  var that = this;
+	  	
+	  	//增加判断昵称和头像是否设置
+	  	if(that.data.avatarUrl == defaultAvatarUrl){
+	  		wx.showToast({
+	  			title: '请设置头像',
+	  			icon: 'none',
+	  			duration: 2000
+	  		});
+	  		return;
+	  	}
+	  	
+	  	if(that.data.nickname == ''){
+	  		wx.showToast({
+	  			title: '请设置昵称',
+	  			icon: 'none',
+	  			duration: 2000
+	  		});
+	  		return;
+	  	}
+	  	
+  		var url = 'v1/user/update/info'
+  		var params = {
+  			  nickname:that.data.nickname,
+  			  birthday:'',
+  			  sex:0,
+  		}
+  		var success = function (res) {
+  			console.log(res);
+  			wx.showToast({
+  			  title: '更新成功',
+  			  icon: 'none',
+  			  duration: 2000
+  			})
+  		}
+  		var fail = function (res) {
+  			console.log(res);
+  		}
+  		
+  		_request.$uploadFile(url,'head',that.data.avatarUrl, params, success,fail) 
+  	  that.onLoad()
+  	  
+  },
 })

+ 17 - 1
pages/user/all/all.wxml

@@ -1,8 +1,24 @@
 <!--登陆界面-->
 <view class="logindiv" wx:if="{{userInfo == 'nologin'}}">
 	<image class="logindiv_image" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/xcx/start.png"></image>
-    <button class="loginbtn" bindtap="getUserProfile">微信授权登陆</button>
+	<!-- 旧版弃用 -->
+    <!-- <button class="loginbtn" bindtap="getUserProfile">微信授权登陆</button> -->
     <!-- <button class="loginbtn" open-type="getUserInfo" bindgetuserinfo="getUserInfo">微信授权登陆</button> -->
+	<view class="container">
+	  <view class="auth-title">完成登录前,请先完善以下资料</view>
+	  <view class="auth-subtitle" style="margin-bottom: 45rpx;">你的公开信息(昵称、头像等)</view>
+	  <label>我的头像</label>
+	  <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar" style="width: 140rpx;height: 140rpx;border-radius: 50%;background: #f0f0f0;margin-bottom:22rpx;padding:0;    margin: auto;">
+		<image class="avatar" src="{{avatarUrl}}" style="width: 140rpx;height: 140rpx;border-radius: 50%;"></image>
+	  </button> 
+	  
+	  <label>我的昵称</label>
+	  <input type="nickname" class="weui-input" placeholder="请输入昵称" bindinput="changeNickName" bindblur="changeNickName" style="margin-bottom:120rpx"/>
+	 
+	  <view class="login-btn">
+	    <button class="btn-normal" catchtap="savebtn">确定登录</button>
+	  </view>
+	</view>
 </view>
     
 

+ 71 - 2
pages/user/all/all.wxss

@@ -314,7 +314,7 @@ z-index: 9;
 .logindiv_image{
 width: 100%;
 height: 400px;
-
+    margin-top: -35%;
 }
 .loginbtn{
 background: #FFF;
@@ -347,4 +347,73 @@ color: #eab86a;
 	    font-size: 36rpx;
 	    font-weight: bold;
 }
-.kfqr image{width: 100%;}
+.kfqr image{width: 100%;}
+
+
+.container {
+    margin: 10% 10%;
+    width: 80%;
+    box-sizing: border-box;
+    height: 60%;
+    background: #ffffff;
+    padding: 25rpx;
+    border-radius: 15rpx;
+	margin-top: -30%;
+}
+
+.wechatapp {
+  padding: 80rpx 0 48rpx;
+  border-bottom: 1rpx solid #e3e3e3;
+  margin-bottom: 72rpx;
+  text-align: center;
+}
+
+.wechatapp .header {
+  width: 190rpx;
+  height: 190rpx;
+  border: 2px solid #fff;
+  margin: 0rpx auto 0;
+  border-radius: 50%;
+  overflow: hidden;
+  box-shadow: 1px 0px 5px rgba(50, 50, 50, 0.3);
+}
+
+.auth-title {
+  color: #585858;
+  font-size: 34rpx;
+}
+
+.auth-subtitle {
+  color: #888;
+  margin-bottom: 88rpx;
+  font-size: 28rpx;
+}
+
+.login-btn {
+  padding: 0 20rpx;
+}
+
+.login-btn button {
+  height: 80rpx;
+  line-height: 80rpx;
+  background: #eab86a;
+  color: #fff;
+  font-size: 30rpx;
+  border-radius: 999rpx;
+  text-align: center;
+}
+
+.no-login-btn {
+  margin-top: 20rpx;
+  padding: 0 20rpx;
+}
+
+.no-login-btn button {
+  height: 88rpx;
+  line-height: 88rpx;
+  background: #dfdfdf;
+  color: #fff;
+  font-size: 30rpx;
+  border-radius: 999rpx;
+  text-align: center;
+}

+ 5 - 2
project.private.config.json

@@ -1,6 +1,9 @@
 {
   "setting": {
-    "urlCheck": false
+    "urlCheck": false,
+    "compileHotReLoad": true
   },
-  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "projectname": "fohowXcx",
+  "libVersion": "2.30.2"
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 5556 - 0
utils/place.js