<template>
	<view class="order-list content">
		<view class="list-wrap">
			<u-sticky bgColor="#fff" class="sticky-main">
				<view class="search-wrap">
					<view class="input-wrap">
						<view class="input search">
							<u-search bgColor='#fff' :showAction='false'
								:placeholder="$t('base.common.inputPlaceholder')" @search="bindClientList"
								@clear='bindClientList' v-model="keyword">
							</u-search>
							<view class="sx-btn" @click="bindClientList">{{$t("customer_meter.search")}}</view>
						</view>
					</view>
				</view>
			</u-sticky>
			<template v-if="clientList.length">
				<view class="business-card" v-for="item in clientList" :key="item.id">
					<view class="title">
						<text class="info">NO {{item.companyCode || ''}}</text>
						<view class="info">
							<u-tag :text="(item.companyEnableMark==1 ? $t('mine.enable'):$t('mine.disable'))"
								shape="circle" :type="(item.companyEnableMark==1?'success':'error')">
							</u-tag>
						</view>
					</view>
					<view class="business-card-info">
							<view class="info-line">
								<text class="info">{{item.companyName || ''}}</text>
								<text class="info"  v-if="vehicleType=='101'">余额  {{item.balance || '0.00'}}</text>
							</view>
					</view>
				</view>
			</template>
			<template v-else>
				<u-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png">
				</u-empty>
			</template>

		</view>
	</view>
</template>

<script>
	import {
		getClientList
	} from "../../api/tenant.js";
	export default {
		data() {
			return {
				keyword: "",
				value: "",
				enterpriseCode: "",
				clientList: [],
				tenantId: '',
				vehicleType: '101',
			};
		},
		components: {},
		onLoad(options) {
			this.tenantId = options.tenantId
			this.vehicleType = options.vehicleType;
			this.bindClientList();
		},
		methods: {
			bindClientList() {
				let data = {
					tenantId: this.tenantId,
					vehicleType: this.vehicleType,
					keywords: this.keyword || '',
				}
				getClientList(data).then((res) => {
					if (res.statusCode == 200) {
						this.clientList = res.data.data;
					}
				});
			},
		},
	};
</script>
<style>
/* #ifndef APP-NVUE */
view {
  box-sizing: border-box;
}
	page {
		background-color: #f5f7fa;
	}
/* #endif */
</style>
<style lang="scss" scoped>
	@import '../../common/css/public.scss';
	.input{
		padding: 0;
	}
</style>