<template>
	<view>
		<view v-if="!storeList" class="mart60 fotct font14 fcor666">
			<image mode="widthFix" style="width: 70vw;" src="../../../static/img/noorder.png"></image>
		</view>
		<view class="width94 backcorfff border-r mart15" v-for="(item,index) in storeList" :key="index"
			@click="jumpstoredes(item.id)">
			<view class="notes" style="border-bottom: 0px;">
				<image src="../../../static/img/store/store7.png" mode="widthFix" class="iconw40"></image>
				<view class="width65 margle">
					<view class="font14 fcor333">{{item.name}}</view>
					<view class="font12 fcor999">{{item.createTime | timeFormat('yyyy-mm-dd')}}
						{{item.createTime | timeFormat('hh:mm')}}
					</view>
				</view>
				<view class="storestus" v-if="item.status == 2">
					正常
				</view>
				<view class="otstatucs" v-if="item.status == 3">
					审核中
				</view>
				<view class="otstatucs" v-if="item.status == 4">
					审核驳回
				</view>
				<view class="otstatucs" v-if="item.status == 5">
					停用
				</view>

			</view>
			<view class="conts" style="border-bottom: 0px;">
				<image src="../../../static/img/store/store8.png" mode="widthFix" class="iconw"></image>
				<view class="margle10 font14 fcor999">{{item.account.telephone}}</view>
			</view>
			<view class="conts" style="border-bottom: 0px;">
				<image src="../../../static/img/store/store9.png" mode="widthFix" class="iconw"></image>
				<view class="margle10 font14 fcor999">{{item.telephone}}</view>
			</view>
			<view class="conts" style="border-bottom: 0px;">
				<image src="../../../static/img/store/store10.png" mode="widthFix" class="iconw"></image>
				<view class="margle10 font14 fcor999 width90p">{{item.storeRegion.address}}</view>
			</view>
			
			<view class="height45 width100">
				<button class="btns mart10 marRight10" @click.stop="jumpMineDevice(item.id)">查看设备</button>
			</view>
			<view class="width100 height10"></view>
		</view>
		<image src="../../../static/img/addser.png" mode="widthFix" class="xfimg" @click="jumpaddstore"></image>
	</view>
</template>

<script>
	import {
		getStoreListByMer
	} from '../../../Utils/Api.js';
	let app = getApp();
	export default {
		data() {
			return {
				storeList: '',
				userInfo: app.globalData.userInfo
			}
		},
		onShow() {
			this.storeList = '';
			this.getStoreListByMer();
		},
		methods: {
			//跳转到门店详情
			jumpstoredes(item) {
				uni.navigateTo({
					url: '../store-details/store-details?id=' + item
				})
			},
			//查询门店列表
			getStoreListByMer() {
				uni.showLoading({
					title: '加载中...'
				})
				let datas = {
					merId: this.userInfo.mer.id,
					pageNum: 1,
					pageSize: 10
				}
				getStoreListByMer(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000' && res.return_data.list !='') {
						this.storeList = res.return_data.list;
					} else {
						this.storeList = '';
					}
				})
			},
			//跳转添加门店
			jumpaddstore() {
				uni.navigateTo({
					url: '../addStore/addStore'
				})
			},
			//跳转设备列表
			jumpMineDevice(item){
				uni.navigateTo({
					url:'/pages/index/mineService/mineService?id=5'+'&storeid='+item
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f6f6f6;
	}

	.notes {
		width: calc(100% - 40rpx);
		display: flex;
		align-items: center;
		padding: 30rpx 0 30rpx 20rpx;
		border-bottom: 1px solid #f6f6f6;
	}

	.storestus {
		padding: 1px 5px;
		color: #91bb88;
		font-size: 14px;
		background-color: #e8fbe6;
	}

	.otstatucs {
		background-color: #fbeee4;
		color: #db8c73;
		font-size: 14px;
		padding: 1px 5px;
	}

	.conts {
		width: calc(100% - 60rpx);
		display: flex;
		align-items: center;
		padding: 0 30rpx 10rpx 30rpx;
	}

	.xfimg {
		width: 100rpx;
		bottom: 60rpx;
		position: fixed;
		right: 40rpx;
	}
	
	.btns {
		width: 21%;
		margin-left: 5%;
		float: left;
		height: 35px;
		line-height: 35px;
		background-color: #0083f5;
		color: #FFFFFF;
		font-weight: bold;
		font-size: 12px;
		padding: 0px;
	}
</style>
