import { React, useState, useEffect, useMemo, useRef } from 'react' import Taro, { useRouter } from '@tarojs/taro' import { getVerifiedOrder } from '@/services/shopBoss' import Picker from '@/components/Picker' import ShopUsed from '@/components/ShopUsed' //已核销 import ShopUnused from '@/components/ShopUnused' //未核销 import SearchBar from '@/components/SearchBar' import List from '@/components/List'; import NoData from '@/components/NoData' import eyes from '@/assets/icons/shopKeeper/eyesON.png' import ceyes from '@/assets/icons/shopKeeper/eyesOFF.png' import ToggleRole from '@/components/toggleRole/ToggleRole' import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png' import './shopKeeper.less' export default (props) => { const { shopList, shop, onHotelChange, verifiedOrder, shopMoney, onVarified } = props const { params } = useRouter() const { tabJump } = params || {} const [activeTab, setActiveTab] = useState(0) const [phonea, setPhone] = useState() const [isVerifieda, setisVerified] = useState(0) const queryParams = useMemo(() => ({ shopId: shop?.shopId, isVerified: isVerifieda, phone: phonea || '', }), [phonea, shop?.shopId, isVerifieda]) // 获取资源表信息 const [alllist, setAllList] = useState([]) const [isyear, setYear] = useState(true) const [isMomth, setMonth] = useState(false) //小眼睛开关 const handleYear = () => { isyear ? setYear(false) : setYear(true) } const handleMonth = () => { isMomth ? setMonth(false) : setMonth(true) } const handleHotelChange = (e, current) => { onHotelChange(current) } const listRef = useRef() const handelSearch = (e) => { const val = e.detail.value setPhone(val) } useEffect(() => { if (tabJump) { setActiveTab(tabJump - 0) } }, [tabJump]) const handleTabChange = (e) => { const { index } = e.detail setActiveTab(index) setisVerified(index) //如果context有的话代表他滚动了 那么切换tab页就置顶 if (listRef.current?.context) { listRef.current.context.scrollTo({ top: 0 }) } } const tabs = [ { title: '未核销订单', }, { title: '已核销订单', }, ] //给父组件传val const handleVarified = () => { onVarified() } const [showCutover, setShowCutover] = useState(false) const ShowMoldeOn = () => { setShowCutover(true) } const onClose = () => { setShowCutover(false) } return ( 店名: (计算收入以核销为准) 全年订单收入(税前) {isyear ? (shopMoney?.totalCharges / 100).toFixed(2) : '******'} 当月订单收入(税前) {isMomth ? (shopMoney?.currentCharges / 100).toFixed(2) : '******'} {/* 未核销 */} {activeTab === 0 && } render={({ item, index }) => } > } {/* 已核销 */} {activeTab === 1 && } request={getVerifiedOrder} params={queryParams} onDataChange={setAllList} render={({ item, index }) => } > } ) }