<template>
	<view>
		
		<view v-if="image_list.length>0 && is_show_image==true" class="tututu">
			<view v-for="(item,index) in image_list" :key="index">
				<image mode="widthFix" :src="$url+item" />
			</view>
			<view class="tu_button_main">
				<view class="tu_button" >
					<view @click="goto('1')">下一步</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script setup>
	 import {
	 	ref
	 } from 'vue'
	 import {
	 	GetComboImageListAction,
	 	$url,
	 	$image,
	 	$response
	 } from '@/api'
import CheckLogin from '@/components/check_login/check_login.vue'
	 import {
	 	onShow
	 } from '@dcloudio/uni-app'
	 import {
	 	useStore
	 } from '@/store'
	 const $store = useStore()
	 
	 //获取图片列表
	 let image_list=ref([])
	 let is_show_image=ref(false)
	 const getComboImage=async()=>{
	 	const response = await GetComboImageListAction({
	 		hospital: $store.buy_info.hospital,
	 		combo:$store.buy_info.combo
	 	})
	 	$response(response, () => {

	 		 if(response.data.info){
	 			let arr = response.data.info.imgs.split(",")
	 			 
	 			arr.forEach(function(v,k){
	 				if(v != ""){
	 					image_list.value.push(v)
	 					is_show_image.value=true
	 				}
	 			})
	 			console.log( image_list.value)
	 		 }else{
	 			image_list.value=[]
	 		 }
	 		 console.log(image_list.value.length)
			 if(image_list.value.length>0){
				 
			 }else{
				goto('noimage')
			 }
	 	})
	 }
	 const goto=(type)=>{
		 uni.$lu.user((info) => {
			 console.log('---------',info)
			 if(info.id===0){
				 uni.$lu.toast("请登录")
				 setTimeout(()=>{
					 uni.switchTab({
					 	url: '/pages/main/home/home'
					 })
				 },1000)
				
				 return false;
			 }else{
				 if(type=='noimage'){
				 			 if ($store.buy_info.person.length === 0) {
				 			 	uni.reLaunch({
				 			 		url: '/pages/buy/person/person?type=info'
				 			 	})
				 			 } else {
				 			 	uni.reLaunch({
				 			 		url: '/pages/buy/info/info'
				 			 	})
				 			 }
				 }else{
				 			 if ($store.buy_info.person.length === 0) {
				 			 	uni.navigateTo({
				 			 		url: '/pages/buy/person/person?type=info'
				 			 	})
				 			 } else {
				 			 	uni.navigateTo({
				 			 		url: '/pages/buy/info/info'
				 			 	})
				 			 }
				 }
			 }
		 })
		
		
	 }
	onShow(() => {
		 
	 	getComboImage()
	})
</script>

<style scoped>
	.tututu image{
		 width: 100%;
	}
	.tu_button_main{
		padding: 0rpx 20rpx;
	}
	.tu_button{
		position: fixed;
		bottom: 60rpx;
		border: 1px solid #5FCAEA;
		padding:10rpx 0rpx;
		height: 50rpx;
		border-radius: 25rpx;
		width:calc(100% - 40rpx) ;
		text-align: center;
	}
</style>
