You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							256 lines
						
					
					
						
							6.7 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							256 lines
						
					
					
						
							6.7 KiB
						
					
					
				
								<template>
							 | 
						|
									<view>
							 | 
						|
										<lf-nav :spreadOut="true" :showIcon="true" bgColor="#F8F8F8" title="会员资料"></lf-nav>
							 | 
						|
										<view class="lf-font-26 lf-color-primary lf-p-30 lf-row-center">
							 | 
						|
											尊敬的会员,完善资料可以让我们为您提供更贴切的服务
							 | 
						|
										</view>
							 | 
						|
										<view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													*姓名
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<input type="text" class="edit-input" v-model="info.name" placeholder="请输入姓名" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view>
							 | 
						|
										<!-- <view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													国籍
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<input type="text" class="edit-input" v-model="info.native_place" placeholder="请输入你的国籍" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view> -->
							 | 
						|
										<view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													性别
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<input type="text" class="edit-input" :value="info.sex" :disabled="true" placeholder="未填写" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view>
							 | 
						|
										<view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													出生日期
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<input type="text" class="edit-input" :value="info.birthday" :disabled="true" placeholder="未填写" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view>
							 | 
						|
										<view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													身份证号
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<input type="text" class="edit-input" :value="info.id_number" :disabled="true" placeholder="未填写" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view>
							 | 
						|
										<view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													通讯地址
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<picker mode="region" :value="info.address" @change="addressChange" >
							 | 
						|
														<text class="address-picker">{{ info.address.join('') || '请选择' }}</text>
							 | 
						|
													</picker>
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view>
							 | 
						|
										<view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black"></view>
							 | 
						|
												<view class="lf-flex lf-w-100">
							 | 
						|
													<input type="text" class="edit-input lf-w-100" v-model="info.address_detail" placeholder="请输入您的详细地址" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view>
							 | 
						|
										<!-- <view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													家庭地址
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<input type="text" class="edit-input" v-model="info.home_address" placeholder="请输入您的家庭地址" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view> -->
							 | 
						|
										<!-- <view class="lf-p-l-32 lf-p-r-32">
							 | 
						|
											<view class="set-tag lf-border-bottom">
							 | 
						|
												<view class="lf-font-28 lf-color-black">
							 | 
						|
													学历
							 | 
						|
												</view>
							 | 
						|
												<view class="lf-flex">
							 | 
						|
													<input type="text" class="edit-input" v-model="info.education" placeholder="请输入您的学历" />
							 | 
						|
												</view>
							 | 
						|
											</view>
							 | 
						|
										</view> -->
							 | 
						|
										
							 | 
						|
										<view class="lf-font-26 lf-color-999 lf-p-30 lf-row-center">
							 | 
						|
											温馨提示:身份证号出生日期不支持线上修改,如需修改请前往服务台办理。
							 | 
						|
										</view>
							 | 
						|
										
							 | 
						|
										<button class="set-btn" hover-class="lf-opacity" @click="submit">保存</button>
							 | 
						|
									</view>
							 | 
						|
									
							 | 
						|
								</template>
							 | 
						|
								
							 | 
						|
								<script>
							 | 
						|
									export default {
							 | 
						|
										data() {
							 | 
						|
											return {
							 | 
						|
												info: {
							 | 
						|
													name: '',
							 | 
						|
													native_place: '',
							 | 
						|
													sex: '',
							 | 
						|
													birthday: '',
							 | 
						|
													id_number: '',
							 | 
						|
													address: [],
							 | 
						|
													address_detail: '',
							 | 
						|
													home_address: '',
							 | 
						|
													education: ''
							 | 
						|
												},
							 | 
						|
												token: ''
							 | 
						|
											}
							 | 
						|
										},
							 | 
						|
										onLoad(){
							 | 
						|
											var token = this.$cookieStorage.get('user_token');
							 | 
						|
											this.token = token;
							 | 
						|
											this.getMeInfo();
							 | 
						|
										},
							 | 
						|
										methods: {
							 | 
						|
											getMeInfo(){
							 | 
						|
												this.$http.get({
							 | 
						|
													api: 'api/me',
							 | 
						|
													header: {
							 | 
						|
														Authorization: this.token
							 | 
						|
													}
							 | 
						|
												}).then(res => {
							 | 
						|
													let detail = res.data.data;
							 | 
						|
													let info = this.info;
							 | 
						|
													info.name = detail.name;
							 | 
						|
													info.sex = detail.sex;
							 | 
						|
													info.birthday = detail.birthday;
							 | 
						|
													// info.native_place = detail.country;
							 | 
						|
													
							 | 
						|
													if(detail.province && detail.city && detail.area){
							 | 
						|
														let address = [detail.province, detail.city, detail.area];
							 | 
						|
														info.address = address;
							 | 
						|
													}
							 | 
						|
													info.address_detail = detail.postal_address;
							 | 
						|
													// info.home_address = detail.home_address;
							 | 
						|
													
							 | 
						|
													
							 | 
						|
													// todo 其他信息待补充... id_number身份证
							 | 
						|
													this.info = info;
							 | 
						|
												})
							 | 
						|
											},
							 | 
						|
											getValue(current, event){
							 | 
						|
												this[current +'_index'] = event.detail.value;
							 | 
						|
											},
							 | 
						|
											addressChange(event){
							 | 
						|
												this.info.address = event.detail.value;
							 | 
						|
											},
							 | 
						|
											submit(){
							 | 
						|
												let par = {};
							 | 
						|
												if(this.info.name){
							 | 
						|
													par.name = this.info.name; // 姓名
							 | 
						|
												}
							 | 
						|
												if(this.info.native_place){
							 | 
						|
													par.country = this.info.native_place; // 国籍
							 | 
						|
												}
							 | 
						|
												if(this.info.address.length){
							 | 
						|
													let address = this.info.address;
							 | 
						|
													par.province = address[0]; // 省
							 | 
						|
													par.city = address[1]; // 市
							 | 
						|
													par.area = address[2]; // 区
							 | 
						|
												}
							 | 
						|
												if(this.info.address_detail){
							 | 
						|
													par.postal_address = this.info.address_detail; // 通讯详细地址
							 | 
						|
												}
							 | 
						|
												if(this.info.home_address){
							 | 
						|
													par.home_address = this.info.home_address; // 家庭地址
							 | 
						|
												}
							 | 
						|
												if(this.info.education){
							 | 
						|
													par.education = this.info.education; // 学历
							 | 
						|
												}
							 | 
						|
												if(Object.keys(par).length <= 0){
							 | 
						|
													return this.$msg('您未填写资料哦', {icon: 'error'})
							 | 
						|
												}
							 | 
						|
												uni.showLoading({
							 | 
						|
													title: '正在保存中'
							 | 
						|
												});
							 | 
						|
												this.$http.post({
							 | 
						|
													api: 'api/users/update/info',
							 | 
						|
													data: par,
							 | 
						|
													header: {
							 | 
						|
														Authorization: this.token,
							 | 
						|
														Accept: 'application/json'
							 | 
						|
													}
							 | 
						|
												}).then(res => {
							 | 
						|
													uni.hideLoading();
							 | 
						|
													if(res.data.code == 200){
							 | 
						|
														this.$msg('保存成功', {icon: 'success'});
							 | 
						|
													}
							 | 
						|
												}).catch(err => {
							 | 
						|
													uni.hideLoading();
							 | 
						|
													this.$msg('保存失败', {icon: 'error'});
							 | 
						|
												})
							 | 
						|
											}
							 | 
						|
										}
							 | 
						|
									}
							 | 
						|
								</script>
							 | 
						|
								
							 | 
						|
								<style scoped lang="scss">
							 | 
						|
									// .input{
							 | 
						|
									// 	width: 400rpx;
							 | 
						|
									// 	text-align: right;
							 | 
						|
									// }
							 | 
						|
									.picker-w{
							 | 
						|
										width: 400rpx;
							 | 
						|
										text-align: right;
							 | 
						|
									}
							 | 
						|
									.set-btn {
							 | 
						|
										width: 550rpx;
							 | 
						|
										height: 100rpx;
							 | 
						|
										background: #15716E;
							 | 
						|
										border-radius: 50rpx;
							 | 
						|
										margin: 40rpx auto;
							 | 
						|
										font-size: 32rpx;
							 | 
						|
										color: white;
							 | 
						|
										line-height: 100rpx;
							 | 
						|
									}
							 | 
						|
									.edit-input {
							 | 
						|
										text-align: right;
							 | 
						|
										font-size: 28rpx;
							 | 
						|
										color: #777;
							 | 
						|
									}
							 | 
						|
									.set-tag {
							 | 
						|
										height: 100rpx;
							 | 
						|
										width: 100%;
							 | 
						|
										display: flex;
							 | 
						|
										align-items: center;
							 | 
						|
										justify-content: space-between;
							 | 
						|
										// border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
							 | 
						|
									}
							 | 
						|
									.address-picker{
							 | 
						|
										font-size: 28rpx;
							 | 
						|
										color: #777777;
							 | 
						|
										display: inline-block;
							 | 
						|
										width: 400rpx;
							 | 
						|
										text-align: right;
							 | 
						|
									}
							 | 
						|
									/deep/.input-placeholder {
							 | 
						|
										font-size: 28rpx;
							 | 
						|
										color: #777;
							 | 
						|
									}
							 | 
						|
								</style>
							 |