
import CustomNav from '@/components/CustomNav'
import { useState } from "react";
import withLayout from '@/layouts'

import Taro from '@tarojs/taro'
import image from '@/assets/icons/ProCard/8kb.jpg'
import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
import SeeDetails from '@/assets/icons/GuideCheck/SeeDetails.png'

import Attractions from '@/assets/icons/GuideCheck/Attractions.png'
import food from '@/assets/icons/ProCard/food.png'
import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
import position from '@/assets/icons/GuideCheck/position_logo.png'

import starOn from '@/assets/icons/GuideCheck/starOn.png'
import starOff from '@/assets/icons/GuideCheck/starOff.png'

import './style.less'

const scoreList = new Array(5).fill(0)
const score = '3.9'

export default withLayout((props) => {
  const { router, person } = props

  const [value, setVaule] = useState('已收藏')
  const [imageSrc, setImageSrc] = useState(starOn)




  const Ac = () => {
    setImageSrc(starOff)
    setVaule('加入收藏')
    // console.log('------------', value);

  }
  return (
    <view className='box-content'>
      <CustomNav title='我的收藏' />
      <view class='wrapper'>
        <view class='left-complete-one'>
          <image className='left-image-1' src={ProCard_hot}></image>
          <view className='left-viewText'>
            返现￥16.00
          </view>
          {/* 评分 */}
          <view className='card-box-star'>
            {
              scoreList.map((_, index) => {

                const src = (index + '0.1') < score ? starOn : starOff
                return (
                  <image className='card-star-image' key={index} src={src} />
                )
              })
            }
            <text className='card-star-text' >{score}</text>
          </view>
          <view className='title-image'>
            <image className='image-1' mode='scaleToFill' src={image}></image>
            <image className='image-2' src={food}></image>
          </view>
          <view className='title-content'>
            <view className='Pro-title'>
              <view className='title-text'>【橘里橘啊换行啊啊啊气咖啡店】新鲜出炉啦!</view>
            </view>
            <text className='title-money' >￥6990元<text className='title-money-2'>门市价78元</text></text>
            <view className='title-position-on'>
              <image className='title-position' src={position} />
              <text className='title-position-image'>南京市/秦淮区</text>
              <image className='title-on' src={imageSrc} />
              <text onClick={() => Ac()} className='title-on-text'>{value}</text>
            </view>
          </view>
        </view>
        <view class='right-complete-two'>
          <view className='right-content'>
            <image className='right-image' src={SeeDetails} />
            <view className='right-title'>查看详情</view>
          </view>
        </view>
      </view>
      <view class='wrapper'>
        <view class='left-complete-one'>
          <image className='left-image-1' src={ProCard_hot}></image>
          <view className='left-viewText'>
            返现￥16.00
          </view>
          {/* 评分 */}
          <view className='card-box-star'>
            {
              scoreList.map((_, index) => {

                const src = (index + '0.1') < score ? starOn : starOff
                return (
                  <image className='card-star-image' key={index} src={src} />
                )
              })
            }
            <text className='card-star-text' >{score}</text>
          </view>
          <view className='title-image'>
            <image className='image-1' mode='scaleToFill' src={image}></image>
            <image className='image-2' src={food}></image>
          </view>
          <view className='title-content'>
            <view className='Pro-title'>
              <view className='title-text'>【橘里橘啊换行啊啊啊气咖啡店】新鲜出炉啦!</view>
            </view>
            <text className='title-money' >￥6990元<text className='title-money-2'>门市价78元</text></text>
            <view className='title-position-on'>
              <image className='title-position' src={position} />
              <text className='title-position-image'>南京市/秦淮区</text>
              <image className='title-on' src={imageSrc} />
              <text onClick={() => Ac()} className='title-on-text'>{value}</text>
            </view>
          </view>
        </view>
        <view class='right-complete-two'>
          <view className='right-content'>
            <image className='right-image' src={SeeDetails} />
            <view className='right-title'>查看详情</view>
          </view>
        </view>
      </view>
      <view class='wrapper'>
        <view class='left-complete-one' style='padding-top: 20px;'>
          <view className='title-image'>
            <image className='image-1' mode='scaleToFill' src={image}></image>
            <image className='image-2' src={Attractions}></image>
          </view>
          <view className='title-content'>
            <view className='Pro-title'>
              <view className='title-text'>【橘里橘啊换行啊啊啊气咖啡店】新鲜出炉啦!</view>
            </view>
            <text className='title-money' >￥6990元<text className='title-money-2'>门市价78元</text></text>
            <view className='title-position-on'>
              <image className='title-position' src={position} />
              <text className='title-position-image'>南京市/秦淮区</text>
              <image className='title-on' src={imageSrc} />
              <text onClick={() => Ac()} className='title-on-text'>{value}</text>
            </view>
          </view>
        </view>
        <view class='right-complete-two'>
          <view className='right-content'>
            <image className='right-image' src={SeeDetails} />
            <view className='right-title'>查看详情</view>
          </view>
        </view>
      </view>
      <view className='foot'>
        已经到底了~
      </view>
    </view>
  )
})
