<template>
	<view class="container">
		<uni-list border class="list">
			<uni-list-item
				v-for="(item, index) in districtOptions"
				:key="index"
				:ellipsis="2"
				:title="item.value"
				showArrow
				clickable
				@click="listItemBtn(item)">				
			</uni-list-item>
		</uni-list>
		<uni-load-more :status="more" />
	</view>
</template>

<script>
	import dictApi from '../../api/dict.js';
	import request from '../../api/shop.js';
	import { BASE_URL } from '../../env.js';
	export default {
		onLoad: function (option) {
			this.status = option.status;
		},
		data() {
			return {
				districtSelected: '',
				districtOptions: [],
			}
		},
		async mounted() {
			await this.getDicts();
		},
		methods: {
			async getDicts() {				
				const resp_district = await dictApi.getDict('che_district');
				if (resp_district.code == 200) 
					this.districtOptions = resp_district.data.map(l => ({ ...l, value: l.dictValue, text: l.dictLabel }));
			},
			// 列表点击函数
			listItemBtn(e) {
				uni.navigateTo({ url: `/pages/shop/taglist?district=${e.value}&status=${this.status}` })
			},
		}
	}
</script>

<style>
</style>
