spreadMoney.jsx 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { useState, useMemo } from 'react'
  2. import Taro from '@tarojs/taro'
  3. import List from '@/components/List';
  4. import Picker from '@/components/Picker'
  5. import { getAccount } from '@/services/shopBoss'
  6. import ShopCommission from '@/components/ShopCommission'
  7. import eyes from '@/assets/icons/shopKeeper/eyesON.png'
  8. import ceyes from '@/assets/icons/shopKeeper/eyesOFF.png'
  9. import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
  10. import NoData from '@/components/NoData'
  11. import ToggleRole from '@/components/toggleRole/ToggleRole'
  12. import './spreadMoney.less'
  13. const getList = (id) => (params) => getAccount(id, params)
  14. export default (props) => {
  15. const { shopList, shop, onHotelChange, shopMoney } = props
  16. const [showCutover, setShowCutover] = useState(false)
  17. const [isyear, setYear] = useState(true)
  18. const [isMomth, setMonth] = useState(false)
  19. const queryParams = useMemo(() => ({}), [])
  20. const reqestAPI = getList(shopMoney?.acc?.accountId)
  21. //小眼睛开关
  22. const handleYear = () => {
  23. isyear ? setYear(false) : setYear(true)
  24. }
  25. const handleMonth = () => {
  26. isMomth ? setMonth(false) : setMonth(true)
  27. }
  28. //商铺更改
  29. const handleHotelChange = (shopId, current) => {
  30. onHotelChange(current)
  31. }
  32. const ShowMoldeOn = () => {
  33. setShowCutover(true)
  34. }
  35. const onClose = () => {
  36. setShowCutover(false)
  37. }
  38. return (
  39. <view>
  40. <view style={{ padding: '0 15px 0 15px', height: '100%' }}>
  41. <ToggleRole showCutover={showCutover} maskClosable={showCutover} onClose={onClose} role='shop' />
  42. <view className='storexx'>
  43. <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择商铺" value={shop?.shopId} kv={['shopName', 'shopId']} dicts={shopList} onChange={handleHotelChange} /></view>
  44. <view onClick={ShowMoldeOn} className='User-info-cutover'>
  45. <image className='User-info-cutover-image' src={cutoverUser} />
  46. </view>
  47. <view className='tip'>(计算收入以核销为准)</view>
  48. <view className='money'>
  49. <view className='sleft'>
  50. <view className='lword'>全年推广收入(税前)</view>
  51. <view className='yearMoney'>
  52. <text>{isyear ? (shopMoney?.totalCharges / 100).toFixed(2) : '******'}</text>元
  53. <image className='micon' src={isyear ? eyes : ceyes} onClick={handleYear} />
  54. </view>
  55. </view>
  56. <view className='line' />
  57. <view className='sright'>
  58. <view className='rword'>当月推广收入(税前)</view>
  59. <view className='monthMoney'>
  60. <text>{isMomth ? (shopMoney?.currentCharges / 100).toFixed(2) : '******'}</text>元
  61. <image className='micon2' src={isMomth ? eyes : ceyes} onClick={handleMonth}></image>
  62. </view></view>
  63. </view>
  64. </view>
  65. <view className='title'>推广收入记录</view>
  66. <view style={{ height: '50vh' }}>
  67. <List
  68. style={{ height: '100%' }}
  69. request={reqestAPI}
  70. params={queryParams}
  71. noData={<NoData />}
  72. refresherEnabled
  73. render={({ item, index }) => <ShopCommission key={(index)} item={item} />}
  74. >
  75. </List>
  76. </view>
  77. </view>
  78. </view >
  79. )
  80. }