<template>
	<view class="container">
		<navBar title="服务" :back="false" color="black" flex="cen" background="#fff" />

		<view class="list" v-if="list.length!=0">
			<view class="item" v-for="(item,index) in list">
				<view class="topTitle">
					<view class="water">
						GIGESI
					</view>
					<text>{{item.title}}</text>
				</view>

				<view class="con" @click="goDetail(item1.content,item1.title,item1)" v-for="(item1,index1) in item.list"
					:style="{background:`url(${picBase+item1.image}) ` }">
					<view class="grayTrans">
						<view class="label">
							<image src="/static/index/part1_icon.png" mode="" class="img"></image>
							<view class="item2">
								{{item1.title}}
							</view>
							<view class="des">
								详情
							</view>
						</view>
						<view class="cen">
							<view class="item3" v-for="(item2,index2) in item1.label">
								{{item2.title}}
							</view>
						</view>

						<view class="bot">
							<image class="img2" :src="picUrl+'/static/service/look.png'" mode=""
								style="width: 48rpx;height: 48rpx;">
							</image>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="con" v-else style="justify-content: center;">
			<u-empty mode="data" text="暂无数据" width="160" height="160" :icon="picUrl+'/static/other/empty.png'">
			</u-empty>
		</view>

		<u-loading-page :loading="loading" image="/static/index/logo.png" loading-text="页面加载中..."></u-loading-page>
	</view>
</template>

<script>
	import {
		getServerDataReq
	} from '@/api/test/index.js'
	import uploadUrl from '@/common/config.js'
	export default {
		// components: {
		// 	navBar
		// },
		data() {
			return {
				picUrl: this.$picUrl,
				picBase: this.$picBase,
				list: [],

				showOverFlow: true,

				loading: true
			}
		},
		async onLoad(options) {
			let res = await getServerDataReq({})
			if (res.code == 0) {
				this.list = res.data
				this.loading = false
				console.log('服务列表: ', res, this.list);
			} else {
				this.loading = false
				uni.showToast({
					title: res.message,
					icon: 'none'
				})
			}
		},
		onShow() {
			// if (!uni.getStorageSync('switchs')) {
			uni.setStorageSync('switchs', [1, 0, 0])
			// }
			// if (!uni.getStorageSync('priceConfig')) {
			uni.request({
				url: uploadUrl.baseUrl + '/api/common/getPriceConfig',
				method: "GET",
				success: (res) => {
					if (res.data.code == 0) {
						console.log('my中获取的会员折扣数据', res.data.data)
						uni.setStorageSync('priceConfig', res.data.data)
					}
				}
			})
			// }
		},
		methods: {
			goDetail(content, title, item) {
				getApp().serCon = content
				getApp().sTitle = title
				getApp().Sdetail = item
				uni.navigateTo({
					url: '/pages/service/detail/index'
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import "./service.scss";
</style>