lalala пре 6 година
родитељ
комит
cf83b8523b

+ 128 - 120
mobile-code/src/components/app-area-sel.vue

@@ -8,7 +8,7 @@
 				</div>
 				</div>
 				<!-- 搜索 -->
 				<!-- 搜索 -->
 				<div class="map-search">
 				<div class="map-search">
-					<app-search-module placeholder="请输入你的收货地址" @input="searchFn" />
+					<app-search-module ref="aaaaa" placeholder="请输入你的收货地址" :focus="true" @input="searchFn" />
 				</div>
 				</div>
 				<!-- 地图 -->
 				<!-- 地图 -->
 				<!-- <div class="map-box">
 				<!-- <div class="map-box">
@@ -20,7 +20,7 @@
 							</cover-view>
 							</cover-view>
 						</cover-view>
 						</cover-view>
 					</map>
 					</map>
-				</div> -->
+				</div>-->
 				<!-- 列表 -->
 				<!-- 列表 -->
 				<scroll-view class="near-list" scroll-y>
 				<scroll-view class="near-list" scroll-y>
 					<view v-for="(item,index) in nearListData" :key="index" @click="switchAddress(item,index)" class="near-item">
 					<view v-for="(item,index) in nearListData" :key="index" @click="switchAddress(item,index)" class="near-item">
@@ -37,131 +37,139 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import BottomPopup from '@/components/plugin/bottom-popup'
-import AppClose from '@/components/module/app-close'
-import AppSearchModule from '@/components/module/app-search'
-// api
-import { suggestion } from '@/api/common'
-export default {
-	name: 'app-area-sel',
-	components: {
-		BottomPopup,
-		AppClose,
-		AppSearchModule
-	},
-	props: {
-		show: {
-			type: Boolean,
-			default: false
+	import BottomPopup from '@/components/plugin/bottom-popup'
+	import AppClose from '@/components/module/app-close'
+	import AppSearchModule from '@/components/module/app-search'
+	// api
+	import { suggestion } from '@/api/common'
+	export default {
+		name: 'app-area-sel',
+		components: {
+			BottomPopup,
+			AppClose,
+			AppSearchModule
 		},
 		},
-		city: {
-			type: String,
-			default: ''
-		}
-	},
-	data() {
-		return {
-			showPopup: false,
-			keyword: '',
-			// 地图
-			// latitude: 24.44579,
-			// longitude: 118.08243,
-			// 列表
-			currentSelectAddress: null,
-			nearListData: []
-		}
-	},
-	// onLoad(val) {
-	// 	this.mapCtx = uni.createMapContext('myMap')
-	// 	this.query = val
-	// 	this.reload()
-	// },
-	watch: {
-		show(val) {
-			this.showPopup = val
-			if (val) {
-				this.getAreaList()
+		props: {
+			show: {
+				type: Boolean,
+				default: false
+			},
+			city: {
+				type: String,
+				default: ''
 			}
 			}
-		}
-	},
-	methods: {
-		getAreaList() {
-			suggestion({ region: this.city, keyword: this.keyword }).then(res => {
-				this.nearListData = res.data.data
-			})
 		},
 		},
-		// 搜索
-		searchFn(e) {
-			this.keyword = e
-			this.getAreaList()
-			// this.$emit('search', e)
-			// uni.reverseGeocode({
-			// 	latitude: 25.661333498914413,
-			// 	longitude: 117.5537109375
-			// }, (e) => {
-			// 	console.log(e)
-			// })
+		data() {
+			return {
+				showPopup: false,
+				keyword: '',
+				// 地图
+				// latitude: 24.44579,
+				// longitude: 118.08243,
+				// 列表
+				currentSelectAddress: null,
+				nearListData: []
+			}
 		},
 		},
-		hidePopup() {
-			this.$emit('update:show', false)
-			this.$emit('hide')
+		// onLoad(val) {
+		// 	this.mapCtx = uni.createMapContext('myMap')
+		// 	this.query = val
+		// 	this.reload()
+		// },
+
+		watch: {
+			show(val) {
+				this.showPopup = val
+
+				// #ifdef H5
+				this.$nextTick(function() {
+					this.$refs.aaaaa.$refs.searchInput._focusInput()
+				})
+				// #endif
+
+				// if (val) {
+				// 	this.getAreaList()
+				// }
+			}
 		},
 		},
-		switchAddress(item, index) {
-			this.currentSelectAddress = index
-			// this.latitude = item.location.lat
-			// this.longitude = item.location.lng
-			// if (!this.$util.isEmpty(item.province) && !this.$util.isEmpty(item.city)) {
-			// 	this.currentRegion = [item.province, item.city, item.district]
-			// }
-			this.$emit('change', item)
-			this.hidePopup()
+		methods: {
+			getAreaList() {
+				suggestion({ region: this.city, keyword: this.keyword }).then(res => {
+					this.nearListData = res.data.data
+				})
+			},
+			// 搜索
+			searchFn(e) {
+				this.keyword = e
+				this.getAreaList()
+				// this.$emit('search', e)
+				// uni.reverseGeocode({
+				// 	latitude: 25.661333498914413,
+				// 	longitude: 117.5537109375
+				// }, (e) => {
+				// 	console.log(e)
+				// })
+			},
+			hidePopup() {
+				this.$emit('update:show', false)
+				this.$emit('hide')
+			},
+			switchAddress(item, index) {
+				this.currentSelectAddress = index
+				// this.latitude = item.location.lat
+				// this.longitude = item.location.lng
+				// if (!this.$util.isEmpty(item.province) && !this.$util.isEmpty(item.city)) {
+				// 	this.currentRegion = [item.province, item.city, item.district]
+				// }
+				this.$emit('change', item)
+				this.hidePopup()
+			}
+			// 地图操作
+			// reload() {
+			// 	uni.getLocation({
+			// 		type: 'wgs84',
+			// 		success: res => {
+			// 			this.latitude = res.latitude
+			// 			this.longitude = res.longitude
+			// 			// this.nearList()
+			// 		},
+			// 		// eslint-disable-next-line handle-callback-err
+			// 		fail: err => {
+			// 			this.$msg('定位失败')
+			// 			// setTimeout(function() {
+			// 			// 	uni.navigateBack({
+			// 			// 		delta: 1
+			// 			// 	})
+			// 			// }, 1500)
+			// 		}
+			// 	})
+			// },
+			// mapChange(e) {
+			// 	if (e.type == 'end' && (e.causedBy == 'scale' || e.causedBy == 'drag')) {
+			// 		this.mapCtx.getCenterLocation({
+			// 			success: res => {
+			// 				this.longitude = res.longitude
+			// 				this.latitude = res.latitude
+			// 				// this.nearList()
+			// 			}
+			// 		})
+			// 	}
+			// },
+			// 获取列表
+			// nearList() {
+			// 	geocoder({
+			// 		latitude: this.latitude,
+			// 		longitude: this.longitude
+			// 	}).then(res => {
+			// 		console.log(res)
+			// 		let data = res.result
+			// 		this.currentSelectAddress = 0
+			// 		this.nearListData = data.pois
+			// 		// this.currentRegion = [data.address_component.province, data.address_component.city, data.address_component.district]
+			// 	})
+			// },
 		}
 		}
-		// 地图操作
-		// reload() {
-		// 	uni.getLocation({
-		// 		type: 'wgs84',
-		// 		success: res => {
-		// 			this.latitude = res.latitude
-		// 			this.longitude = res.longitude
-		// 			// this.nearList()
-		// 		},
-		// 		// eslint-disable-next-line handle-callback-err
-		// 		fail: err => {
-		// 			this.$msg('定位失败')
-		// 			// setTimeout(function() {
-		// 			// 	uni.navigateBack({
-		// 			// 		delta: 1
-		// 			// 	})
-		// 			// }, 1500)
-		// 		}
-		// 	})
-		// },
-		// mapChange(e) {
-		// 	if (e.type == 'end' && (e.causedBy == 'scale' || e.causedBy == 'drag')) {
-		// 		this.mapCtx.getCenterLocation({
-		// 			success: res => {
-		// 				this.longitude = res.longitude
-		// 				this.latitude = res.latitude
-		// 				// this.nearList()
-		// 			}
-		// 		})
-		// 	}
-		// },
-		// 获取列表
-		// nearList() {
-		// 	geocoder({
-		// 		latitude: this.latitude,
-		// 		longitude: this.longitude
-		// 	}).then(res => {
-		// 		console.log(res)
-		// 		let data = res.result
-		// 		this.currentSelectAddress = 0
-		// 		this.nearListData = data.pois
-		// 		// this.currentRegion = [data.address_component.province, data.address_component.city, data.address_component.district]
-		// 	})
-		// },
 	}
 	}
-}
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>

+ 4 - 5
mobile-code/src/components/app-delivery.vue

@@ -152,16 +152,15 @@
 		watch: {
 		watch: {
 			orderShop(val) {
 			orderShop(val) {
 				console.log('val', val)
 				console.log('val', val)
-				this.form.receiveProvince = val.shop.shopProvince ? val.shop.shopProvince : ''
-				this.form.receiveCity = val.shop.shopCity ? val.shop.shopCity : ''
+				this.form.receiveProvince = val.shop.province ? val.shop.province : ''
+				this.form.receiveCity = val.shop.city ? val.shop.city : ''
 			}
 			}
 		},
 		},
 		mounted() {
 		mounted() {
 			if (!this.$util.isEmpty(this.orderShop)) {
 			if (!this.$util.isEmpty(this.orderShop)) {
-				this.form.receiveProvince = this.orderShop.shop.shopProvince ? this.orderShop.shop.shopProvince : ''
-				this.form.receiveCity = this.orderShop.shop.shopCity ? this.orderShop.shop.shopCity : ''
+				this.form.receiveProvince = this.orderShop.shop.province ? this.orderShop.shop.province : ''
+				this.form.receiveCity = this.orderShop.shop.city ? this.orderShop.shop.city : ''
 			}
 			}
-			// console.log('江总', this.anonymous)
 			// if (this.anonymous) {
 			// if (this.anonymous) {
 				this.form.anonymous = '0'
 				this.form.anonymous = '0'
 			// }
 			// }

+ 81 - 76
mobile-code/src/components/module/app-search.vue

@@ -5,82 +5,87 @@
 				<i class="iconfont" :class="[icon]"></i>
 				<i class="iconfont" :class="[icon]"></i>
 			</div>
 			</div>
 			<div class="input-wrap">
 			<div class="input-wrap">
-				<input type="text" v-model="search" @input="inputFn" :style="{fontSize: fontSize + 'rpx'}" :placeholder="placeholder" placeholder-class="placeholder" />
+				<input ref="searchInput" type="text" v-model="search" :focus="focus" @input="inputFn" :style="{fontSize: fontSize + 'rpx'}" :placeholder="placeholder" placeholder-class="placeholder" />
 			</div>
 			</div>
 		</div>
 		</div>
-        <block v-if="isBtn">
-            <button v-if="isTextBtn" class="search-btn" :style="{fontSize: fontSize + 'rpx'}" @click="searchFn">{{ btnText }}</button>
-		    <button v-else class="search-btn admin-button-com middle blue" :style="{fontSize: fontSize + 'rpx'}" @click="searchFn">{{ btnText }}</button>
-        </block>
+		<block v-if="isBtn">
+			<button v-if="isTextBtn" class="search-btn" :style="{fontSize: fontSize + 'rpx'}" @click="searchFn">{{ btnText }}</button>
+			<button v-else class="search-btn admin-button-com middle blue" :style="{fontSize: fontSize + 'rpx'}" @click="searchFn">{{ btnText }}</button>
+		</block>
 	</div>
 	</div>
 </template>
 </template>
 
 
 <script>
 <script>
-export default {
-	name: 'app-search-module',
-	props: {
-		// 搜索组件的高度
-		height: {
-			type: Number,
-			default: 66
-		},
-		placeholder: {
-			type: String,
-			default: '请输入'
-		},
-		// size字体大小
-		fontSize: {
-			type: Number,
-			default: 26
-		},
-		// 是否有icon
-		isIcon: {
-			type: Boolean,
-			default: true
-		},
-		// 显示的icon
-		icon: {
-			type: String,
-			default: 'iconsearch'
-		},
-		// 背景色
-		backColor: {
-			type: String,
-			default: '#F0F2F6'
-		},
-		// 是否需要按钮
-		isBtn: {
-			type: Boolean,
-			default: false
-		},
-		// 是否是文字按钮
-		isTextBtn: {
-			type: Boolean,
-			default: true
+	export default {
+		name: 'app-search-module',
+		props: {
+			// 搜索组件的高度
+			height: {
+				type: Number,
+				default: 66
+			},
+			placeholder: {
+				type: String,
+				default: '请输入'
+			},
+			// size字体大小
+			fontSize: {
+				type: Number,
+				default: 26
+			},
+			// 是否有icon
+			isIcon: {
+				type: Boolean,
+				default: true
+			},
+			// 显示的icon
+			icon: {
+				type: String,
+				default: 'iconsearch'
+			},
+			// 背景色
+			backColor: {
+				type: String,
+				default: '#F0F2F6'
+			},
+			// 是否需要按钮
+			isBtn: {
+				type: Boolean,
+				default: false
+			},
+			// 是否是文字按钮
+			isTextBtn: {
+				type: Boolean,
+				default: true
+			},
+			// 按钮文字
+			btnText: {
+				type: String,
+				default: '搜索'
+			},
+			// 是否自动聚焦
+			focus: {
+				type: Boolean,
+				default: false
+			}
 		},
 		},
-		// 按钮文字
-		btnText: {
-			type: String,
-			default: '搜索'
-		}
-	},
-	data() {
-		return {
-			search: ''
-		}
-	},
-	methods: {
-		searchFn() {
-			this.$emit('search', this.search)
+		data() {
+			return {
+				search: ''
+			}
 		},
 		},
-		inputFn(e) {
-			// console.log('sdfa', e)
-			setTimeout(() => {
-				this.$emit('input', this.search)
-			})
+		methods: {
+			searchFn() {
+				this.$emit('search', this.search)
+			},
+			inputFn(e) {
+				// console.log('sdfa', e)
+				setTimeout(() => {
+					this.$emit('input', this.search)
+				})
+			}
 		}
 		}
 	}
 	}
-}
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
@@ -89,7 +94,7 @@ export default {
 		@include disFlex(center, space-between);
 		@include disFlex(center, space-between);
 		.map-search {
 		.map-search {
 			@include disFlex(center, flex-start);
 			@include disFlex(center, flex-start);
-		    width: 100%;
+			width: 100%;
 			height: 100%;
 			height: 100%;
 			border-radius: 10px;
 			border-radius: 10px;
 			.icon-wrap {
 			.icon-wrap {
@@ -110,14 +115,14 @@ export default {
 					color: #ccc;
 					color: #ccc;
 				}
 				}
 			}
 			}
-        }
-        // 按钮
-        .search-btn {
-            height: 100%;
-            padding: 0 20px;
-            flex-shrink: 0;
-            margin-left: 20px;
-            background-color: inherit;
-        }
+		}
+		// 按钮
+		.search-btn {
+			height: 100%;
+			padding: 0 20px;
+			flex-shrink: 0;
+			margin-left: 20px;
+			background-color: inherit;
+		}
 	}
 	}
 </style>
 </style>