348 lines
		
	
	
		
			8.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
		
		
			
		
	
	
			348 lines
		
	
	
		
			8.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
|  | <template> | ||
|  | 	<view> | ||
|  | 		<view class="top-box"> | ||
|  | 			<view class="search-box"> | ||
|  | 				<!-- <u-icon name="search" size="36rpx" color="#999"></u-icon> --> | ||
|  | 				<input @confirm="searchName" confirm-type="search" class="search-input" type="text" | ||
|  | 					v-model="form.storeCode" value="" :placeholder="$t('S_C_70')+$t('MN_F_T_1206')" /> | ||
|  | 			</view> | ||
|  | 			<view class="f26 gray9 ml20" style="flex-shrink: 0;" @click="openPop()">{{$t('MY_ORD_50')}}</view> | ||
|  | 		</view> | ||
|  | 		<view class="wallet-list"> | ||
|  | 			<view class="bonus-item" v-for="(item,index) in listData" :key="index" @click="storeDate(item)"> | ||
|  | 				<view class="bonus-item-item"> | ||
|  | 					<view class="bonus-item-name f26 gray9">{{$t('MN_F_T_1207')}}</view> | ||
|  | 					<view class="bonus-item-content f26 gray3">{{item.storeName}}</view> | ||
|  | 				</view> | ||
|  | 				<view class="bonus-item-item"> | ||
|  | 					<view class="bonus-item-name f26 gray9">{{$t('MN_F_T_1206')}}</view> | ||
|  | 					<view class="bonus-item-content f26 gray3">{{item.storeCode}}</view> | ||
|  | 				</view> | ||
|  | 				<view class="bonus-item-item"> | ||
|  | 					<view class="bonus-item-name f26 gray9">{{$t('S_C_86')}}</view> | ||
|  | 					<view class="bonus-item-content f26 gray3">{{item.storePerson}}</view> | ||
|  | 				</view> | ||
|  | 				<view class="bonus-item-item"> | ||
|  | 					<view class="bonus-item-name f26 gray9">{{$t('w_0052')}}</view> | ||
|  | 					<view class="bonus-item-content f26 gray3">{{item.storePhone}}</view> | ||
|  | 				</view> | ||
|  | 				<view class="bonus-item-item"> | ||
|  | 					<view class="bonus-item-name f26 gray9">{{$t('S_C_27')}}</view> | ||
|  | 					<view class="bonus-item-content f26 gray3">{{item.address}}</view> | ||
|  | 				</view> | ||
|  | 			</view> | ||
|  | 		</view> | ||
|  | 		<view class="d-c-c p30" v-if="listData.length == 0 && !loading"> | ||
|  | 			<text class="iconfont icon-wushuju"></text> | ||
|  | 			<text class="cont">{{$t('w_0405')}}</text> | ||
|  | 		</view> | ||
|  | 		<uni-load-more v-else :loadingType="loadingType"></uni-load-more> | ||
|  | 		<!-- 筛选 --> | ||
|  | 		<u-popup :show="showPop" mode="right" @close="closePop" @open="openPop"> | ||
|  | 			<view class="pop-content rightpop"> | ||
|  | 				<view class="pop-title d-b-c"> | ||
|  | 					<view class="f28 gray3">{{$t('MY_ORD_50')}}</view> | ||
|  | 					<view class="f28 domation" @click="closePop">{{$t('N_I_241')}}</view> | ||
|  | 				</view> | ||
|  | 				<view class="right-item-title">{{ $t('MN_F_T_1206') }}</view> | ||
|  | 				<view style="padding: 0 24rpx;"><u-search :placeholder="$t('S_C_70')+$t('MN_F_T_1206')" :clearabled="true" | ||
|  | 						:showAction="false" v-model="form.storeCode"></u-search></view> | ||
|  | 				<view class="right-item-title">{{ $t('S_C_27') }}</view> | ||
|  | 				<view style="padding: 0 24rpx;" @click="showMulLinkageThreePicker"><u-search :placeholder="$t('w_0070')" | ||
|  | 						:clearabled="true" :showAction="false" v-model="selectCity"></u-search></view> | ||
|  | 				<view class="pop-btns"> | ||
|  | 					<view class="pop-left-btn" @click="resetSubmit()">{{$t('w_0257')}}</view> | ||
|  | 					<view class="pop-right-btn" @click="searchSubmit()">{{$t('w_0035')}}</view> | ||
|  | 				</view> | ||
|  | 			</view> | ||
|  | 		</u-popup> | ||
|  | 		<mpvue-city-picker v-if="is_load" ref="mpvueCityPicker" :province="province" :city="city" :area="area" | ||
|  | 			: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: { | ||
|  | 			uniLoadMore, | ||
|  | 			mpvueCityPicker | ||
|  | 		}, | ||
|  | 		data() { | ||
|  | 			const currentDate = this.getDate({ | ||
|  | 				format: true | ||
|  | 			}); | ||
|  | 			return { | ||
|  | 				cityPickerValueDefault: [0, 0, 0], | ||
|  | 				selectCity: '', | ||
|  | 				recProvince: '', | ||
|  | 				recCity: '', | ||
|  | 				recCounty: '', | ||
|  | 				address: {}, | ||
|  | 				delta: 1, | ||
|  | 				province: [], | ||
|  | 				city: [], | ||
|  | 				area: [], | ||
|  | 				is_load: false, | ||
|  | 				showPop: false, | ||
|  | 				date1: '', | ||
|  | 				date2: '', | ||
|  | 				/*有没有等多*/ | ||
|  | 				no_more: false, | ||
|  | 				/*是否正在加载*/ | ||
|  | 				loading: true, | ||
|  | 				listData: [], | ||
|  | 				form: { | ||
|  | 					pageNum: 1, | ||
|  | 					pageSize: 10, | ||
|  | 					startCreateTime: '', | ||
|  | 					endCreateTime: '', | ||
|  | 					storeCode: '', | ||
|  | 					memberName: '', | ||
|  | 					// gradeId:''
 | ||
|  | 				}, | ||
|  | 				total: 0, | ||
|  | 				areaData: [], | ||
|  | 				userCountry:'', | ||
|  | 			}; | ||
|  | 		}, | ||
|  | 		onLoad(e) { | ||
|  | 			this.userCountry=e.userCountry; | ||
|  | 			this.getGradeData(); | ||
|  | 		}, | ||
|  | 		onShow() { | ||
|  | 			/*获取数据*/ | ||
|  | 			this.listData = []; | ||
|  | 			this.form.pageNum = 1; | ||
|  | 			this.getData(); | ||
|  | 		}, | ||
|  | 		onReachBottom() { | ||
|  | 			let self = this; | ||
|  | 			if (self.form.pageNum * self.form.pageSize < self.total) { | ||
|  | 				self.form.pageNum++; | ||
|  | 				self.getData(); | ||
|  | 			} | ||
|  | 			self.no_more = true; | ||
|  | 		}, | ||
|  | 		computed: { | ||
|  | 			/*加载中状态*/ | ||
|  | 			loadingType() { | ||
|  | 				if (this.loading) { | ||
|  | 					return 1; | ||
|  | 				} else { | ||
|  | 					if (this.listData.length != 0 && this.no_more) { | ||
|  | 						return 2; | ||
|  | 					} else { | ||
|  | 						return 0; | ||
|  | 					} | ||
|  | 				} | ||
|  | 			}, | ||
|  | 			startDate() { | ||
|  | 				return this.getDate('start'); | ||
|  | 			}, | ||
|  | 			endDate() { | ||
|  | 				return this.getDate('end'); | ||
|  | 			} | ||
|  | 		}, | ||
|  | 		methods: { | ||
|  | 			storeDate(item) { | ||
|  | 				console.log(item, 'item'); | ||
|  | 				// 返回上一页
 | ||
|  | 				const data = { | ||
|  | 					storeName: item.storeName, | ||
|  | 					storeCode: item.storeCode, | ||
|  | 					pkId: item.pkId | ||
|  | 				}; // 你要传递的数据
 | ||
|  | 				// this.$emit('handleStoreData', data);
 | ||
|  | 				this.$fire.fire('handleStoreData', data); | ||
|  | 				uni.navigateBack({ | ||
|  | 					delta: 1, | ||
|  | 				}); | ||
|  | 			}, | ||
|  | 			showMulLinkageThreePicker() { | ||
|  | 				this.$refs.mpvueCityPicker.show(); | ||
|  | 			}, | ||
|  | 
 | ||
|  | 			/*确定选择的省市区*/ | ||
|  | 			onConfirm(e) { | ||
|  | 				console.log(e); | ||
|  | 				this.selectCity = e.label; | ||
|  | 				this.recProvince = e.cityCode[0]; | ||
|  | 				this.recCity = e.cityCode[1]; | ||
|  | 				this.recCounty = e.cityCode[2]; | ||
|  | 			}, | ||
|  | 			getGradeData() { | ||
|  | 				let self = this; | ||
|  | 				// self.loading = true;
 | ||
|  | 				self._get( | ||
|  | 					'system/api/area/tree', {pkCountry:this.userCountry}, | ||
|  | 					function(res) { | ||
|  | 						self.province = res.data; | ||
|  | 						self.is_load = true; | ||
|  | 					}, {}, | ||
|  | 					() => { | ||
|  | 						// self.loading = false;
 | ||
|  | 					} | ||
|  | 				); | ||
|  | 			}, | ||
|  | 			getData() { | ||
|  | 				let self = this; | ||
|  | 				self.loading = true; | ||
|  | 				self.form.pkCountry=this.userCountry; | ||
|  | 				var formdata = self.form; | ||
|  | 				self._get( | ||
|  | 					'member/api/store/store-list', formdata, | ||
|  | 					function(res) { | ||
|  | 						self.listData = [...self.listData, ...res.rows]; | ||
|  | 						self.total = res.total; | ||
|  | 						if (self.total < (self.form.pageNum * self.form.pageSize)) { | ||
|  | 							self.no_more = true; | ||
|  | 						} | ||
|  | 					}, {}, | ||
|  | 					() => { | ||
|  | 						self.loading = false; | ||
|  | 					} | ||
|  | 				); | ||
|  | 			}, | ||
|  | 			closePop() { | ||
|  | 				this.showPop = false; | ||
|  | 			}, | ||
|  | 			openPop() { | ||
|  | 				this.showPop = true; | ||
|  | 			}, | ||
|  | 			getDate(type) { | ||
|  | 				const date = new Date(); | ||
|  | 				let year = date.getFullYear(); | ||
|  | 				let month = date.getMonth() + 1; | ||
|  | 				let day = date.getDate(); | ||
|  | 
 | ||
|  | 				if (type === 'start') { | ||
|  | 					year = year - 60; | ||
|  | 				} else if (type === 'end') { | ||
|  | 					year = year + 2; | ||
|  | 				} | ||
|  | 				month = month > 9 ? month : '0' + month; | ||
|  | 				day = day > 9 ? day : '0' + day; | ||
|  | 				return `${year}-${month}-${day}`; | ||
|  | 			}, | ||
|  | 			bindDateChange1: function(e) { | ||
|  | 				this.form.startCreateTime = e.detail.value; | ||
|  | 			}, | ||
|  | 			bindDateChange2: function(val) { | ||
|  | 				this.form.province = val[0]; | ||
|  | 				this.form.city = val[1]; | ||
|  | 				// this.form.endCreateTime = e.detail.value;
 | ||
|  | 			}, | ||
|  | 			bindGrade: function(e) { | ||
|  | 				this.form.gradeId = e.pkId; | ||
|  | 				// console.log(e);
 | ||
|  | 			}, | ||
|  | 			searchSubmit: function() { | ||
|  | 				this.showPop = false; | ||
|  | 				this.form.province = this.recProvince; | ||
|  | 				this.form.city = this.recCity; | ||
|  | 				/*获取数据*/ | ||
|  | 				this.listData = []; | ||
|  | 				this.form.pageNum = 1; | ||
|  | 				this.getData(); | ||
|  | 			}, | ||
|  | 			resetSubmit: function() { | ||
|  | 				this.showPop = false; | ||
|  | 				// 清空筛选条件
 | ||
|  | 				this.form.storeCode = ''; | ||
|  | 				this.recProvince = ''; | ||
|  | 				this.recCity = ''; | ||
|  | 				this.recCounty = ''; | ||
|  | 				this.selectCity = ''; | ||
|  | 				this.form.province = ''; | ||
|  | 				this.form.city = ''; | ||
|  | 				// 重新获取数据
 | ||
|  | 				this.listData = []; | ||
|  | 				this.form.pageNum = 1; | ||
|  | 				this.getData(); | ||
|  | 			}, | ||
|  | 		} | ||
|  | 	}; | ||
|  | </script> | ||
|  | 
 | ||
|  | <style lang="scss"> | ||
|  | 	.top-box { | ||
|  | 		width: 750rpx; | ||
|  | 		padding: 0 30rpx 0 23rpx; | ||
|  | 		box-sizing: border-box; | ||
|  | 		height: 102rpx; | ||
|  | 		background: #ffffff; | ||
|  | 		display: flex; | ||
|  | 		justify-content: center; | ||
|  | 		align-items: center; | ||
|  | 		border-bottom: 1rpx solid #eee; | ||
|  | 		margin-bottom: 24rpx; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.search-box { | ||
|  | 		flex: 1; | ||
|  | 		height: 65rpx; | ||
|  | 		background: #f5f6f8; | ||
|  | 		border-radius: 33rpx; | ||
|  | 		padding: 0 52rpx; | ||
|  | 		box-sizing: border-box; | ||
|  | 		display: flex; | ||
|  | 		justify-content: center; | ||
|  | 		align-items: center; | ||
|  | 
 | ||
|  | 		.search-input { | ||
|  | 			font-size: 26rpx; | ||
|  | 			color: #333; | ||
|  | 			margin-left: 14rpx; | ||
|  | 			flex: 1; | ||
|  | 		} | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bonus-item { | ||
|  | 		padding: 20rpx 25rpx 20rpx 23rpx; | ||
|  | 		background-color: #fff; | ||
|  | 		margin-bottom: 20rpx; | ||
|  | 
 | ||
|  | 		.bonus-bottom { | ||
|  | 			height: 104rpx; | ||
|  | 
 | ||
|  | 			.order-btn { | ||
|  | 				box-sizing: border-box; | ||
|  | 				padding: 0 26rpx; | ||
|  | 				min-width: 146rpx; | ||
|  | 				height: 52rpx; | ||
|  | 				line-height: 52rpx; | ||
|  | 				text-align: center; | ||
|  | 				border-radius: 26rpx; | ||
|  | 				font-size: 24rpx; | ||
|  | 				color: #fff; | ||
|  | 				border: 1rpx solid #eee; | ||
|  | 				margin-left: 18rpx; | ||
|  | 				background: #fb3024; | ||
|  | 				border: 1rpx solid #fb3024; | ||
|  | 				flex-shrink: 0; | ||
|  | 				display: flex; | ||
|  | 				justify-content: center; | ||
|  | 				align-items: center; | ||
|  | 			} | ||
|  | 		} | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bonus-item-item { | ||
|  | 		display: flex; | ||
|  | 		justify-content: space-between; | ||
|  | 		align-items: center; | ||
|  | 		margin-bottom: 30rpx; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bonus-item-name { | ||
|  | 		width: 30%; | ||
|  | 		flex-shrink: 0; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.bonus-item-content { | ||
|  | 		width: 70%; | ||
|  | 		flex-shrink: 0; | ||
|  | 	} | ||
|  | </style> |