index.jsx 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import Taro from '@tarojs/taro'
  2. import useLike from "@/utils/hooks/useLike"
  3. import { View } from '@tarojs/components'
  4. import formatPrice from "@/utils/formatPrice";
  5. import Star from '@/components/Star/Star.jsx'
  6. import position from '@/assets/icons/GuideCheck/position_logo.png'
  7. import SeeDetails from '@/assets/icons/GuideCheck/SeeDetails.png'
  8. import Attractions from '@/assets/icons/GuideCheck/Attractions.png'
  9. import baozan from '@/assets/icons/housemantj/bgood.png'
  10. import weibaozan from '@/assets/icons/housemantj/unLike.png'
  11. import food from '@/assets/icons/ProCard/food.png'
  12. import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
  13. import './style.less'
  14. export default (props) => {
  15. const { item, cardNavigateTo } = props
  16. // const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.targetId)
  17. const [isLike, toggleLike] = useLike(item.isLike, 'tourist', item.targetId)
  18. const targetType = item.targetType
  19. const star = parseFloat(((item.sweetScore + item.environmentScore + item.serviceScore) / 3).toFixed(1));
  20. return (
  21. <View className='View-box-LR'>
  22. <View className='left-View-box'>
  23. {
  24. targetType === "shop_package" && (
  25. <view class='wrapper'>
  26. <view class='left-complete-one' >
  27. <image className='left-image-1' src={ProCard_hot} style={{ display: item.targetType === 'shop_package' ? '' : 'none' }} ></image>
  28. <view className='left-viewText' >
  29. 返现¥{formatPrice(item.cashback)}
  30. </view>
  31. {/* 评分 */}
  32. <view className='card-box-star' style={{ display: item.targetType === 'shop_package' ? '' : 'none' }} >
  33. <Star star={star} />
  34. <text className='card-star-text' >{star}</text>
  35. </view>
  36. <view className='title-image' >
  37. <image className='image-1' mode='scaleToFill' src={item.poster}></image>
  38. <image className='image-2' src={item.targetType === 'tourist' ? Attractions : food}></image>
  39. </view>
  40. <view className='title-content'>
  41. <view className='Pro-title' >
  42. <view className='title-text'>{(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}</view>
  43. </view>
  44. <text className='title-money' >¥{formatPrice(item.actualPrice)}元<text className='title-money-2'>门市价{formatPrice(item.standardPrice)}元</text></text>
  45. <view className='title-position-on'>
  46. <image className='title-position' src={position} />
  47. <text className='title-position-image'>
  48. {
  49. targetType === "shop_package" && (
  50. item.areaPName == null ? item.areaName : item.areaPName + '/' + item.areaName
  51. )
  52. }
  53. </text>
  54. </view>
  55. </view>
  56. </view>
  57. <view class='right-complete-two'>
  58. <view className='right-content' onClick={() => { Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` }); }}>
  59. <image className='right-image' src={SeeDetails} />
  60. <view className='right-title'>查看详情</view>
  61. </view>
  62. </view>
  63. </view>
  64. )
  65. }
  66. </View>
  67. <View className='right-View-box'>
  68. {
  69. targetType !== "shop_package" && (
  70. <view class='wrapper'>
  71. <view class='left-complete-one' >
  72. <view className='title-image'>
  73. <image className='image-1' mode='scaleToFill' src={item.poster}></image>
  74. <image className='image-2' src={item.targetType === 'tourist' ? Attractions : food}></image>
  75. </view>
  76. <view className='title-content'>
  77. <view className='Pro-title' >
  78. <view className='title-text'>{(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}</view>
  79. </view>
  80. <text className='title-money' >¥{formatPrice(item.actualPrice)}元<text className='title-money-2'>门市价{formatPrice(item.standardPrice)}元</text></text>
  81. <view onClick={toggleLike}>
  82. <image className='title-on' src={isLike === 1 ? baozan : weibaozan} />
  83. <text className='title-on-text'>{isLike === 1 ? '已爆赞' : '爆赞'}</text>
  84. </view>
  85. <view className='title-position-on'>
  86. <image className='title-position' src={position} />
  87. <text className='title-position-image'>
  88. {
  89. targetType === "tourist" && (
  90. item.areaPName == null ? item.areaName : (item.areaPName + '/' + item.areaName)
  91. )
  92. }
  93. {
  94. targetType === "shop" && (
  95. item.areaPName === null ? item.areaName : (item.areaPName + '/' + item.areaName)
  96. )
  97. }</text>
  98. </view>
  99. </view>
  100. </view>
  101. <view class='right-complete-two'>
  102. <view className='right-content' onClick={() => { Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` }) }}>
  103. <image className='right-image' src={SeeDetails} />
  104. <view className='right-title'>查看详情</view>
  105. </view>
  106. </view>
  107. </view>
  108. )
  109. }
  110. </View>
  111. </View>
  112. )
  113. }