<template>
	<view>
		<!-- 搜索框 -->
		<!-- <unisearchbar v-model="searchValue" @input="focusInput" placeholder="搜索内容" radius="100">
		</unisearchbar> -->
		<!-- 商户名字 -->
		<!-- <view class="mart20 width100">
			<view class=" mcclist font15 fcor666" v-for="(item,index) in mccList" :key="index" @click="changemcc(item)">
				{{item.maccCode}}
			</view>
		</view> -->
		
		<macclist :listData="mccList" @confirem="changemcc"></macclist>
	</view>
</template>

<script>
	import unisearchbar from '../../../components/uni-search-bar/components/uni-search-bar/uni-search-bar.vue';
	import macclist from  '../../../components/mcclist.vue';
	import {
		getMccList
	} from '../../../Utils/Api.js';
	let app = getApp();
	export default {
		components: {
			unisearchbar,
			macclist
		},
		data() {
			return {
				//搜索内容
				searchValue: '',
				//列表数据
				mccList: [],
			}
		},
		onLoad() {
			this.getMccList();
		},

		methods: {
			//查询mcc商户
			getMccList() {
				getMccList().then(res => {
					if (res.return_code == '000000' && res.return_data) {
						this.mccList = res.return_data;
					}
				});
			},
			// 搜索商户
			focusInput() {
				this.mccList = [];
				this.getMccList();
			},
			//选择某个mcc 并返回
			changemcc(item) {
				app.globalData.mccid = item.maccCode;
				app.globalData.mccname = item.name;
				uni.navigateBack({})
			}
		}
	}
</script>

<style lang="scss">
	// .mcclist {
	// 	width: calc(100% - 50upx);
	// 	height: 100upx;
	// 	display: flex;
	// 	align-items: center;
	// 	background-color: rgba($color: #ffffff, $alpha: 0.1);
	// 	border-bottom: 1px solid #f6f6f6;
	// 	padding: 12upx 25upx;
	// }
</style>