300 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
		
		
			
		
	
	
			300 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
|  | <template> | ||
|  | 	<view> | ||
|  | 		<view class="pop-bg"></view> | ||
|  | 		<view class="pop-storebox"> | ||
|  | 			<view class="pop-store"> | ||
|  | 				<view class="d-e-c ww100 mb40 f-s-0"> | ||
|  | 					<u-icon name="close" @click="closeFunc" size="40rpx" color="#999"></u-icon> | ||
|  | 				</view> | ||
|  | 				<view class="d-c-c select-boxs f-s-0" @click="showMulLinkageThreePicker"> | ||
|  | 					<view class="flex-1 mr10 text-ellipsis f26 gray9">{{nameList || '请选择地址'}}</view> | ||
|  | 					<u-icon name="arrow-down" size="28rpx" color="#333"></u-icon> | ||
|  | 				</view> | ||
|  | 				<view class="d-c-c table-title f-s-0 "> | ||
|  | 					<view class="flex-1 tc text-ellipsis box-s-b" style="padding-left: 45rpx;">店铺名称</view> | ||
|  | 					<view class="flex-1 tc text-ellipsis">店铺编号</view> | ||
|  | 				</view> | ||
|  | 				<scroll-view scroll-y="true" style="height: 626rpx;" @scrolltolower="scrolltolowerFunc" | ||
|  | 					lower-threshold="50"> | ||
|  | 					<view class="d-b-c store-item" v-for="(item,index) in listData" :key="index" | ||
|  | 						@click.stop=" pkMakerSpace = item.pkId" :class="index%2 == 0?'':'single-bg'"> | ||
|  | 						<view class="radio-check" v-if="item.pkId != pkMakerSpace"></view> | ||
|  | 						<view class="radio-check-active d-c-c" v-else><u-icon name="checkbox-mark" size="30rpx" | ||
|  | 								color="#fff"></u-icon></view> | ||
|  | 						<view class="flex-1 tc text-ellipsis f24 gray3">{{item.storeName}}</view> | ||
|  | 						<view class="flex-1 tc text-ellipsis f24 gray3">{{item.storeCode}}</view> | ||
|  | 					</view> | ||
|  | 					<view class="d-c-c p30" v-if="listData.length == 0 && !loading"> | ||
|  | 						<text class="cont">{{$t('w_0405')}}</text> | ||
|  | 					</view> | ||
|  | 				</scroll-view> | ||
|  | 				<view class="border-t bottom-btns d-c-c f-s-0"> | ||
|  | 					<!-- <button class="bottom-btn left-btn" @click="closeFunc">取消</button> --> | ||
|  | 					<!-- <button class="bottom-btn right-btn" @click="comfirFunc">确定</button> --> | ||
|  | 				</view> | ||
|  | 			</view> | ||
|  | 		</view> | ||
|  | 		<mpvue-city-picker v-if="is_load" ref="mpvueCityPicker" :province="province" | ||
|  | 			:pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"></mpvue-city-picker> | ||
|  | 	</view> | ||
|  | </template> | ||
|  | 
 | ||
|  | <script> | ||
|  | 	import uniLoadMore from '@/components/uni-load-more.vue'; | ||
|  | 	import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue'; | ||
|  | 	export default { | ||
|  | 		components: { | ||
|  | 			mpvueCityPicker, | ||
|  | 			uniLoadMore | ||
|  | 		}, | ||
|  | 		data() { | ||
|  | 			return { | ||
|  | 				province: [], | ||
|  | 				city: [], | ||
|  | 				area: [], | ||
|  | 				is_load: false, | ||
|  | 				/* 地址 */ | ||
|  | 				cityPickerValueDefault: [0, 0, 0], | ||
|  | 				form: { | ||
|  | 					licenseCity: 0, | ||
|  | 					licenseCounty: 0, | ||
|  | 					licenseProvince: 0, | ||
|  | 					pageNum: 1, | ||
|  | 					pageSize: 50 | ||
|  | 				}, | ||
|  | 				nameList: '', | ||
|  | 				/*最后一页码数*/ | ||
|  | 				last_page: 0, | ||
|  | 				/*有没有等多*/ | ||
|  | 				no_more: false, | ||
|  | 				/*是否正在加载*/ | ||
|  | 				loading: false, | ||
|  | 				listData: [], | ||
|  | 				total: 0, | ||
|  | 				pkMakerSpace: 0 | ||
|  | 			} | ||
|  | 		}, | ||
|  | 		props: ['isPop'], | ||
|  | 		computed: { | ||
|  | 			/*加载中状态*/ | ||
|  | 			loadingType() { | ||
|  | 				if (this.loading) { | ||
|  | 					return 1; | ||
|  | 				} else { | ||
|  | 					if (this.listData.length != 0 && this.no_more) { | ||
|  | 						return 2; | ||
|  | 					} else { | ||
|  | 						return 0; | ||
|  | 					} | ||
|  | 				} | ||
|  | 			}, | ||
|  | 		}, | ||
|  | 		created() { | ||
|  | 			this.getAreaData() | ||
|  | 		}, | ||
|  | 		methods: { | ||
|  | 
 | ||
|  | 			initData() { | ||
|  | 				this.form.pageNum = 1; | ||
|  | 				this.listData = []; | ||
|  | 				this.pkMakerSpace = 0; | ||
|  | 				this.getData(); | ||
|  | 			}, | ||
|  | 			getData() { | ||
|  | 				let self = this; | ||
|  | 				self.loading = true; | ||
|  | 				let params = this.form; | ||
|  | 				self._post('member/api/maker-space/list-maker', params, res => { | ||
|  | 					self.loading = false; | ||
|  | 					self.listData = self.listData.concat(res.rows); | ||
|  | 					self.total = res.total; | ||
|  | 					if (self.total < self.form.pageNum * self.form.pageSize) { | ||
|  | 						self.no_more = true; | ||
|  | 					} | ||
|  | 				}) | ||
|  | 			}, | ||
|  | 			// 获取省市区
 | ||
|  | 			getAreaData() { | ||
|  | 				let self = this; | ||
|  | 				self._get('system/api/area/tree', { | ||
|  | 					pkCountry: self.userCountry | ||
|  | 				}, function(res) { | ||
|  | 					self.province = res.data; | ||
|  | 					self.is_load = true; | ||
|  | 				}); | ||
|  | 			}, | ||
|  | 			/*三级联动选择*/ | ||
|  | 			showMulLinkageThreePicker() { | ||
|  | 				this.$refs.mpvueCityPicker.show(); | ||
|  | 			}, | ||
|  | 			/* 省市区回显 */ | ||
|  | 			getAddressName(pid, cid, aid, piker) { | ||
|  | 				let self = this; | ||
|  | 				/* 省市区列表 */ | ||
|  | 				if (!self.province) { | ||
|  | 					return; | ||
|  | 				} | ||
|  | 				let add = ''; | ||
|  | 				let citydata = []; | ||
|  | 				let areadata = []; | ||
|  | 				self.province.forEach((item, index) => { | ||
|  | 					if (item['id'] == pid) { | ||
|  | 						add += item['name']; | ||
|  | 						citydata = item['children']; | ||
|  | 						piker[0] = index; | ||
|  | 						citydata.forEach((citem, cindex) => { | ||
|  | 							if (citem['id'] == cid) { | ||
|  | 								add += citem['name']; | ||
|  | 								areadata = citem['children'] ? citem['children'] : []; | ||
|  | 								piker[1] = cindex; | ||
|  | 								if (areadata) { | ||
|  | 									areadata.forEach((aitem, aindex) => { | ||
|  | 										if (aitem['id'] == aid) { | ||
|  | 											add += aitem['name']; | ||
|  | 											piker[2] = aindex; | ||
|  | 											return; | ||
|  | 										} | ||
|  | 									}); | ||
|  | 								} | ||
|  | 							} | ||
|  | 						}); | ||
|  | 					} | ||
|  | 				}); | ||
|  | 				return add; | ||
|  | 			}, | ||
|  | 			/*确定选择的省市区*/ | ||
|  | 			onConfirm(e) { | ||
|  | 				let self = this; | ||
|  | 				self.form['licenseProvince'] = e.cityCode[0]; | ||
|  | 				self.form['licenseCity'] = e.cityCode[1]; | ||
|  | 				self.form['licenseCounty'] = e.cityCode[2]; | ||
|  | 				self.nameList = self.getAddName(); | ||
|  | 				self.initData(); | ||
|  | 			}, | ||
|  | 			getAddName: function() { | ||
|  | 				let self = this; | ||
|  | 				let pid = 0; | ||
|  | 				let cid = 0; | ||
|  | 				let aid = 0; | ||
|  | 				let defaultValue = [0, 0, 0]; | ||
|  | 				pid = self.form['licenseProvince']; | ||
|  | 				cid = self.form['licenseCity']; | ||
|  | 				aid = self.form['licenseCounty']; | ||
|  | 				defaultValue = self.cityPickerValueDefault; | ||
|  | 				let address = self.getAddressName(pid, cid, aid, defaultValue); | ||
|  | 				return address; | ||
|  | 			}, | ||
|  | 			closeFunc() { | ||
|  | 				this.$emit('close', false); | ||
|  | 			}, | ||
|  | 			comfirFunc() { | ||
|  | 				this.$emit('close', this.pkMakerSpace); | ||
|  | 			}, | ||
|  | 		} | ||
|  | 	} | ||
|  | </script> | ||
|  | 
 | ||
|  | <style lang="scss"> | ||
|  | 	.table-title { | ||
|  | 		width: 654rpx; | ||
|  | 		height: 68rpx; | ||
|  | 		background: #F3F3F3; | ||
|  | 		border: 1px solid #EEEEEE; | ||
|  | 		margin-top: 20rpx; | ||
|  | 		font-size: 26rpx; | ||
|  | 		color: #333; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.pop-storebox { | ||
|  | 		position: fixed; | ||
|  | 		transition-duration: 300ms; | ||
|  | 		transition-timing-function: ease-out; | ||
|  | 		z-index: 107; | ||
|  | 		position: fixed; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: center; | ||
|  | 		inset: 0px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.select-boxs { | ||
|  | 		width: 654rpx; | ||
|  | 		height: 68rpx; | ||
|  | 		background: #FFFFFF; | ||
|  | 		border: 1px solid #EEEEEE; | ||
|  | 		padding: 0 20rpx; | ||
|  | 		box-sizing: border-box; | ||
|  | 		line-height: 1; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.pop-store { | ||
|  | 		box-sizing: border-box; | ||
|  | 		border-radius: 20rpx; | ||
|  | 		height: 1070rpx; | ||
|  | 		width: 710rpx; | ||
|  | 		padding: 24rpx 25rpx 10rpx 25rpx; | ||
|  | 		background-color: #fff; | ||
|  | 		display: flex; | ||
|  | 		flex-direction: column; | ||
|  | 		justify-content: space-between; | ||
|  | 		align-items: center; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bottom-btns { | ||
|  | 		padding: 49rpx 0; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bottom-btn { | ||
|  | 		width: 312rpx; | ||
|  | 		height: 72rpx; | ||
|  | 		font-size: 28rpx; | ||
|  | 		display: flex; | ||
|  | 		justify-content: center; | ||
|  | 		align-items: center; | ||
|  | 		text-align: center; | ||
|  | 		line-height: 1.5; | ||
|  | 		border-radius: 34rpx; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bottom-btn.left-btn { | ||
|  | 		background: #eeeeee; | ||
|  | 		color: #333; | ||
|  | 		margin-right: 30rpx; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bottom-btn.right-btn { | ||
|  | 		background: #FB3024; | ||
|  | 		color: #fff; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.single-bg { | ||
|  | 		background-color: rgba(#F3F3F3, 0.4); | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.f-s-0 { | ||
|  | 		flex-shrink: 0; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.store-item { | ||
|  | 		height: 68rpx; | ||
|  | 		font-size: 24rpx; | ||
|  | 		color: #333; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.radio-check { | ||
|  | 		width: 36rpx; | ||
|  | 		height: 36rpx; | ||
|  | 		border: 1rpx solid #EEEEEE; | ||
|  | 		border-radius: 50%; | ||
|  | 		margin-left: 25rpx; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.radio-check-active { | ||
|  | 		width: 36rpx; | ||
|  | 		height: 36rpx; | ||
|  | 		border: 1rpx solid #e03030; | ||
|  | 		background-color: #e03030; | ||
|  | 		border-radius: 50%; | ||
|  | 		margin-left: 25rpx; | ||
|  | 	} | ||
|  | </style> |