Explorar o código

修改注册 地图 vuex更新数据

qukaidi %!s(int64=4) %!d(string=hai) anos
pai
achega
c6ce5e0ef4

+ 7 - 9
components/mi-map/mi-map.vue

@@ -8,13 +8,13 @@
 				<image class="left" :src="myPositionIcon" mode="" @tap="toMyLocation"></image>
 				<view class="right">
 					<text class="title">我的位置</text>
-					<text class="text">{{myAddress}}</text>
+					<text class="text">{{myAddress.addressInfo}}</text>
 				</view>
 			</view>
 
 			<view class="start-place">
 				<view class="place">
-					<text class="text">{{addressObj.address}}</text>
+					<text class="text">{{addressObj.address.addressInfo}}</text>
 				</view>
 				<view class="tip">{{descText}}</view>
 			</view>
@@ -109,7 +109,6 @@
 				this.longitude = res.longitude;
 				this.latitude = res.latitude;
 				this.myAddress = await this.getAddressName(res);
-
 				this.addressObj = Object.assign({}, this.addressObj, {
 					longitude: res.longitude,
 					latitude: res.latitude,
@@ -160,7 +159,7 @@
 						poi_options: "page_size=1;page_index=1",
 						output: 'jsonp',
 						success: (e) => {
-							res(e.result.formatted_addresses.recommend);
+							res({addressInfo:e.result.formatted_addresses.recommend,province:e.result.address_component.province,city:e.result.address_component.city,district:e.result.address_component.district,});
 						},
 						fail: err => {
 							res(err);
@@ -271,14 +270,12 @@
 			.start-place {
 				width: 700rpx;
 				height: 100rpx;
-				margin: 0 auto;
-				margin: 0 auto;
 				box-shadow: 0rpx 3rpx 20rpx rgba(0, 0, 0, 0.2);
 				background: #fff;
 				border-radius: 10rpx;
 				margin-top: 20rpx;
 				.place {
-					margin-left: 10rpx;
+					margin-left: 20rpx;
 					.title {
 						font-size: 24rpx;
 						font-weight: bold;
@@ -287,7 +284,7 @@
 
 					.text {
 						margin-top: 20rpx;
-						font-size: 20rpx;
+						font-size: 24rpx;
 						color: #3384FF;
 						font-weight: bold;
 						width: 700rpx;
@@ -300,7 +297,8 @@
 				}
 
 				.tip {
-					font-size: 0.57rem;
+					margin-left: 20rpx;
+					font-size:20rpx;
 					color: #666;
 				}
 			}

+ 93 - 31
pages/login/register_2.vue

@@ -39,10 +39,10 @@
 						</view>
 						<u-input v-model="form.code" placeholder="请输入验证码" type="number" />
 						<view class="" slot="right">
-							<u-button size="mini" type="primary" @click="getCode" shape="circle" :loading="codeLoading" >{{codeText}}</u-button>
+							<u-button size="mini" type="primary" @click="getCode" shape="circle" :loading="codeLoading">{{codeText}}</u-button>
 						</view>
 					</u-form-item>
-					<u-form-item prop="region">
+<!-- 					<u-form-item prop="region">
 						<view style="margin-right: 10rpx;">
 							<u-icon name="map" size="36"></u-icon>
 						</view>
@@ -51,6 +51,15 @@
 						<view class="" slot="right">
 							<u-icon name="arrow-right" color="#666666" size="36"></u-icon>
 						</view>
+					</u-form-item> -->
+					<u-form-item prop="region">
+						<view style="margin-right: 10rpx;">
+							<u-icon name="map" size="36"></u-icon>
+						</view>
+						<u-input placeholder="点击选择省市区" v-model="form.region" :disabled="true" @click="inMap"></u-input>
+						<view class="" slot="right">
+							<u-icon name="arrow-right" color="#666666" size="36"></u-icon>
+						</view>
 					</u-form-item>
 					<u-form-item prop="addressInfo">
 						<view style="margin-right: 10rpx;">
@@ -104,7 +113,18 @@
 						required: true,
 						message: '请输入门店名称',
 						trigger: 'blur,change'
-					}],
+					},
+					{
+						// 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
+						validator: (rule, value, callback) => {
+							// 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
+							return this.$u.test.chinese(value);
+						},
+						message: '门店名称必须为中文',
+						// 触发器可以同时用blur和change,二者之间用英文逗号隔开
+						trigger: ['change','blur'],
+					},
+					],
 					company: [{
 						required: true,
 						message: '请输入公司名称',
@@ -114,16 +134,51 @@
 						required: true,
 						message: '请输入联系人',
 						trigger: 'blur,change'
+					},{
+						min: 3,
+						max: 5,
+						message: '姓名长度在3到5个字符',
+						trigger: ['change','blur'],
+					},
+					{
+						// 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
+						validator: (rule, value, callback) => {
+							// 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
+							return this.$u.test.chinese(value);
+						},
+						message: '姓名必须为中文',
+						// 触发器可以同时用blur和change,二者之间用英文逗号隔开
+						trigger: ['change','blur'],
 					}],
 					phone: [{
 						required: true,
 						message: '请输入联系电话',
 						trigger: 'blur,change'
+					},
+					{
+						validator: (rule, value, callback) => {
+							// 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
+							return this.$u.test.mobile(value);
+						},
+						message: '手机号码不正确',
+						// 触发器可以同时用blur和change,二者之间用英文逗号隔开
+						trigger: ['change','blur'],
 					}],
 					code: [{
 						required: true,
 						message: '请输入验证码',
 						trigger: 'blur,change'
+					},
+					{
+						min: 6,
+						max: 6,
+						message: '验证码为6位数',
+						trigger: 'change',
+					},
+					{
+						type: 'number',
+						message: '验证码只能为数字',
+						trigger: ['change','blur'],
 					}],
 					region: [{
 						required: true,
@@ -137,65 +192,72 @@
 					}],
 				},
 				dataUrl: "",
-				codeLoading:false,
-				modelshow:false,
-				modelcontent:"如果店名和联系人与营业执照不一致,请重新上传清晰度更高的营业执照"
+				codeLoading: false,
+				modelshow: false,
+				modelcontent: "如果店名和联系人与营业执照不一致,请重新上传清晰度更高的营业执照"
 			};
 		},
 		created() {
 			uni.$on('licenseData', (data) => {
-				this.form.store = data.company.words
+				if(data.company.words!="无"){
+					this.form.store = data.company.words
+				}
 				this.form.company = data.company.words
-				this.form.name = data.person.words
+				if(data.company.words!="无"){
+					this.form.name = data.person.words
+				}
+				
 			})
 			uni.$on('addressData', (data) => {
 				this.form.latitude = data.latitude
 				this.form.longitude = data.longitude
-				this.form.addressInfo = data.address
+				this.address=data.address
+				this.form.region=this.address.province+"-"+this.address.city+"-"+this.address.district
+				this.form.addressInfo =this.address.addressInfo
 			})
 			uni.$on('dataUrl', (data) => {
 				this.dataUrl = data
 			})
 			uni.getSystemInfo({
-			    success:res=>{
-					this.SystemInfo=res
+				success: res => {
+					this.SystemInfo = res
 					console.log(res)
-			    }
+				}
 			});
-			if(this.SystemInfo.platform=='ios'){
+			if (this.SystemInfo.platform == 'ios') {
 				this.judgeIosPermission('location')
 				uni.showModal({
 					title: "温馨提示",
 					content: "如果店名和联系人与营业执照不一致,请重新上传清晰度更高的营业执照?",
 					confirmText: "确认",
-					showCancel:false
+					showCancel: false
 				})
-			}else{
+			} else {
 				this.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION')
-				this.modelshow=true
+				this.modelshow = true
 			}
-			
+
 		},
 		methods: {
 			judgeIosPermission(permisionID) {
 				let result = permision.judgeIosPermission(permisionID)
-				if(!result){
+				if (!result) {
 					this.getLocation()
-				}else{
+				} else {
 					this.getLocation()
 				}
 			},
 			async requestAndroidPermission(permisionID) {
-			    let result = await permision.requestAndroidPermission(permisionID)
+				let result = await permision.requestAndroidPermission(permisionID)
 				if (result == 1) {
-				    this.getLocation()
+					this.getLocation()
 				} else if (result == 0) {
-				    this.getLocation()
+					this.getLocation()
 				} else {
-				    this.getLocation()
+					this.getLocation()
 				}
 			},
-			getLocation(){
+			getLocation() {
 				let that = this
 				uni.getLocation({
 					type: 'wgs84',
@@ -260,13 +322,13 @@
 			},
 			getCode() {
 				if (this.form.phone) {
-					this.codeLoading=true
+					this.codeLoading = true
 					request({
 						url: '/sailun/appStoreBasicInfo/sendCode',
 						method: 'post',
 						data: {
 							"phoneNumber": parseInt(this.form.phone),
-							"opreaType":"0"
+							"opreaType": "0"
 						},
 					}).then(res => {
 						console.log(res)
@@ -283,7 +345,7 @@
 					}).catch(err => {
 						console.log(err)
 					}).finally(() => {
-						this.codeLoading=false
+						this.codeLoading = false
 						// 通知验证码组件内部开始倒计时
 					})
 				} else {
@@ -292,10 +354,10 @@
 
 			},
 			regionConfirm(e) {
-				this.form.region = e.province.label + '-' + e.city.label + '-' + e.area.label;
-				this.form.province = e.province.label;
-				this.form.city = e.city.label;
-				this.form.district = e.area.label;
+				// this.form.region = e.province.label + '-' + e.city.label + '-' + e.area.label;
+				// this.form.province = e.province.label;
+				// this.form.city = e.city.label;
+				// this.form.district = e.area.label;
 			},
 			inMap() {
 				this.$u.route({

+ 21 - 41
pages/login/register_3.vue

@@ -44,7 +44,7 @@
 					</scroll-view>
 				</view>
 			</u-popup>
-			<u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
+			<u-card v-if="querybrandList.length" :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
 				<view slot="head">
 					<view class="u-flex">
 						<view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
@@ -78,9 +78,9 @@
 						<view style="margin-right: 10rpx;">
 							<u-icon name="order" size="36"></u-icon>
 						</view>
-						<u-radio-group v-model="item.taskNum" :disabled="item.disabledGroup" @change="changeRadiogroup">
-							<u-radio v-for="(i, index) in tasknameList" :key="index" :name="i.task">
-								{{i.task}}
+						<u-radio-group v-model="item.taskNum" :disabled="item.disabledGroup" @change="changeRadiogroup(item)">
+							<u-radio v-for="(i, index) in tasknameList" :key="index" :name="i.signLv">
+								{{i.signLv}}
 							</u-radio>
 						</u-radio-group>
 					</u-form-item>
@@ -165,7 +165,7 @@
 					if (res.data.code == 0) {
 						this.agentList = res.data.Data.data
 						this.agentList = this.agentList.reduce((res, item, index, array) => {
-							for (let i = 0; i < array[index].regionBrandList.length; i++) {
+							for (let i = 0; i < array[index].regionBrandList.length; ++i) {
 								res.push({
 									brand: array[index].regionBrandList[i],
 									brandCode: array[index].regionBrandList[i],
@@ -178,12 +178,10 @@
 							}
 							return res;
 						}, []);
-						this.brandList=this.agentList.reduce((res, item, index, array) => {
+						this.brandList=[...new Set(this.agentList.reduce((res, item, index, array) => {
 							res.push(item.brand)
 							return res;
-						}, []);
-						this.brandList=[...new Set(this.brandList)]
-						this.brandList=this.brandList.reduce((res, item, index, array) => {
+						}, []))].reduce((res, item, index, array) => {
 							res.push({brand:item})
 							return res;
 						}, []);
@@ -207,7 +205,6 @@
 					if (res.data.code == 0) {
 					this.querybrandList=res.data.data
 					this.querybrandList = this.querybrandList.filter(item => this.cooperations.indexOf(item.brandCode) > -1)
-					console.log(this.querybrandList)
 					}
 					if (res.data.code == 500) {
 						this.$u.toast(res.data.msg);
@@ -225,13 +222,14 @@
 					data: {},
 				}).then(res => {
 					if (res.data.code == 0) {
-						this.taskList = res.data.data
-						this.tasknameList = this.taskList.reduce((res, item) => {
-							res.push({
-								task: item.signLv,
-							})
-							return res;
-						}, []);
+						this.tasknameList = res.data.data
+						this.tasknameList.push({
+							brand: null,
+							brandCode: null,
+							mainId:null,
+							numTask:null,
+							signLv: "无"
+						})
 					}
 					if (res.data.code == 500) {
 						this.$u.toast(res.data.msg);
@@ -245,30 +243,12 @@
 			checkboxGroupChange(e) {
 				this.cooperations = e
 			},
-			changeRadiogroup(){
-				console.log(this.checkedAgentlist)
-			// 	let repeat=[]
-			// 	this.checkedAgentlist.reduce((res, item, index, array) => {
-			// 		return repeat.push({brand:item.brand,taskNum:item.taskNum})
-			// 	}, []);
-			
-			// let arrD = [];
-			// const map = new Map();
-			// repeat.forEach(v => {  if (map.get(v.brand) && arrD.every(vD => vD.brand != v.brand)) {
-			//     arrD.push(v);
-			// } else {
-			//     map.set(v.brand, v);
-			// }
-			// });
-			// var zdys = (repeat|| []).findIndex((profile) => profile.brand === arrD[0].brand);
-			 
-			// console.log(zdys);
-			// repeat.forEach((item,index,array)=>{
-			// 	if(!array[index].taskNum){
-					
-			// 	}
-			// })
-			
+			changeRadiogroup(item){
+				if(item.taskNum=="无"){
+					this.checkedAgentlist.filter(e=>(e.brand===item.brand&&e.agent_id!=item.agent_id)).forEach(e=>e.disabledGroup=false)
+				}else{
+					this.checkedAgentlist.filter(e=>(e.brand===item.brand&&e.agent_id!=item.agent_id)).forEach(e=>e.disabledGroup=true)
+				}
 			},
 			getCooperation() {
 				if (this.cooperations != null) {

+ 11 - 0
pages/me/index.vue

@@ -206,6 +206,7 @@
 </template>
 
 <script>
+	import {mapState,mapMutations} from 'vuex'
 	import {
 		request
 	} from '../../common/request/request'
@@ -238,10 +239,19 @@
 				}
 			}
 		},
+		computed: {
+			...mapState(['undataStore'])
+		},
 		created() {
 			this.getMyinfo()
 		},
+		onShow() {
+			if(this.undataStore){
+				this.getMyinfo()
+			}
+		},
 		methods: {
+			...mapMutations(["outStore"]),
 			getMyinfo() {
 				request({
 					url: '/myapp/selectStore',
@@ -255,6 +265,7 @@
 					console.log(err)
 				}).finally(() => {
 					this.loading = false;
+					this.outStore();
 					uni.hideLoading();
 				})
 			},

+ 2 - 1
pages/me/setting/setting.vue

@@ -68,12 +68,13 @@
 			};
 		},
 		created() {
+			this.getMyinfo();
 			plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
 				console.log(wgtinfo);
 				console.log(wgtinfo.version); //版本号
 				this.edition_s = wgtinfo.version
 			})
-			this.getMyinfo();
+			
 		},
 		methods: {
 			...mapMutations(["logout"]),

+ 8 - 2
store/index.js

@@ -66,8 +66,8 @@ const store = new Vuex.Store({
 		showToastDuration : 4000,
 		showServerErrorMsg: '连接服务器异常!',
 		hasLogin:false,//用户是否登录
-		storeInfo:{}//存放用户账号数据
-		
+		storeInfo:{},//存放用户账号数据
+		undataStore:false	
 	},
 	mutations: {
 		$uStore(state, payload) {
@@ -111,6 +111,12 @@ const store = new Vuex.Store({
 			uni.removeStorage({
 				key:"token"
 			})
+		},
+		inStore(state){
+			state.undataStore=true;
+		},
+		outStore(state){
+			state.undataStore=false;
 		}
 	}
 })